Skip to content

Commit 8c58b17

Browse files
authored
feat: make beacon API port configurable (#901)
1 parent 3efed57 commit 8c58b17

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

config/config.exs

-9
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ config :lambda_ethereum_consensus, LambdaEthereumConsensus.Telemetry, enable: tr
2525
# Use Jason for JSON parsing in Phoenix
2626
config :phoenix, :json_library, Jason
2727

28-
# Configures the phoenix endpoint
29-
config :lambda_ethereum_consensus, BeaconApi.Endpoint,
30-
http: [port: 4000],
31-
url: [host: "localhost"],
32-
render_errors: [
33-
formats: [json: BeaconApi.ErrorJSON],
34-
layout: false
35-
]
36-
3728
# Load minimal config by default, to allow schema checking
3829
config :lambda_ethereum_consensus, ChainSpec,
3930
config: MinimalConfig,

config/runtime.exs

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ switches = [
1212
metrics: :boolean,
1313
metrics_port: :integer,
1414
validator_file: :string,
15-
log_file: :string
15+
log_file: :string,
16+
beacon_api: :boolean,
17+
beacon_api_port: :integer
1618
]
1719

1820
is_testing = Config.config_env() == :test
@@ -36,6 +38,8 @@ testnet_dir = Keyword.get(args, :testnet_dir)
3638
enable_metrics = Keyword.get(args, :metrics, false)
3739
metrics_port = Keyword.get(args, :metrics_port, if(enable_metrics, do: 9568, else: nil))
3840
validator_file = Keyword.get(args, :validator_file)
41+
enable_beacon_api = Keyword.get(args, :beacon_api, false)
42+
beacon_api_port = Keyword.get(args, :beacon_api_port, 4000)
3943

4044
config :lambda_ethereum_consensus, LambdaEthereumConsensus.ForkChoice,
4145
checkpoint_sync_url: checkpoint_sync_url
@@ -110,6 +114,18 @@ config :lambda_ethereum_consensus, EngineApi,
110114
implementation: implementation,
111115
version: "2.0"
112116

117+
# Beacon API
118+
alias BeaconApi
119+
120+
config :lambda_ethereum_consensus, BeaconApi.Endpoint,
121+
server: enable_beacon_api,
122+
http: [port: beacon_api_port],
123+
url: [host: "localhost"],
124+
render_errors: [
125+
formats: [json: BeaconApi.ErrorJSON],
126+
layout: false
127+
]
128+
113129
# Validator
114130
#
115131
# `validator_file` should be a file with two non-empty lines, the first being

0 commit comments

Comments
 (0)