Skip to content

Commit

Permalink
feat: make beacon API port configurable (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
avilagaston9 authored Mar 20, 2024
1 parent 3efed57 commit 8c58b17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
9 changes: 0 additions & 9 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ config :lambda_ethereum_consensus, LambdaEthereumConsensus.Telemetry, enable: tr
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

# Configures the phoenix endpoint
config :lambda_ethereum_consensus, BeaconApi.Endpoint,
http: [port: 4000],
url: [host: "localhost"],
render_errors: [
formats: [json: BeaconApi.ErrorJSON],
layout: false
]

# Load minimal config by default, to allow schema checking
config :lambda_ethereum_consensus, ChainSpec,
config: MinimalConfig,
Expand Down
18 changes: 17 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ switches = [
metrics: :boolean,
metrics_port: :integer,
validator_file: :string,
log_file: :string
log_file: :string,
beacon_api: :boolean,
beacon_api_port: :integer
]

is_testing = Config.config_env() == :test
Expand All @@ -36,6 +38,8 @@ testnet_dir = Keyword.get(args, :testnet_dir)
enable_metrics = Keyword.get(args, :metrics, false)
metrics_port = Keyword.get(args, :metrics_port, if(enable_metrics, do: 9568, else: nil))
validator_file = Keyword.get(args, :validator_file)
enable_beacon_api = Keyword.get(args, :beacon_api, false)
beacon_api_port = Keyword.get(args, :beacon_api_port, 4000)

config :lambda_ethereum_consensus, LambdaEthereumConsensus.ForkChoice,
checkpoint_sync_url: checkpoint_sync_url
Expand Down Expand Up @@ -110,6 +114,18 @@ config :lambda_ethereum_consensus, EngineApi,
implementation: implementation,
version: "2.0"

# Beacon API
alias BeaconApi

config :lambda_ethereum_consensus, BeaconApi.Endpoint,
server: enable_beacon_api,
http: [port: beacon_api_port],
url: [host: "localhost"],
render_errors: [
formats: [json: BeaconApi.ErrorJSON],
layout: false
]

# Validator
#
# `validator_file` should be a file with two non-empty lines, the first being
Expand Down

0 comments on commit 8c58b17

Please sign in to comment.