diff --git a/config/config.exs b/config/config.exs index 9939373b4..ab2d0f592 100644 --- a/config/config.exs +++ b/config/config.exs @@ -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, diff --git a/config/runtime.exs b/config/runtime.exs index 0a2d3c9ea..5b801a791 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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 @@ -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 @@ -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