Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make beacon API port configurable #901

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading