From 6bbb07bbab14e4d905126fc039e995673aeeda94 Mon Sep 17 00:00:00 2001 From: Ayodeji Akinola Date: Tue, 1 Oct 2024 04:37:14 +0100 Subject: [PATCH] chore(cli): Add warning for misconfigured HTTP API flags (#11360) Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com> --- crates/rpc/rpc-builder/src/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/rpc/rpc-builder/src/config.rs b/crates/rpc/rpc-builder/src/config.rs index 4e86b2c81f6d..4ff98ae8d501 100644 --- a/crates/rpc/rpc-builder/src/config.rs +++ b/crates/rpc/rpc-builder/src/config.rs @@ -6,7 +6,7 @@ use reth_rpc_eth_types::{EthConfig, EthStateCacheConfig, GasPriceOracleConfig}; use reth_rpc_layer::{JwtError, JwtSecret}; use reth_rpc_server_types::RpcModuleSelection; use tower::layer::util::Identity; -use tracing::debug; +use tracing::{debug, warn}; use crate::{ auth::AuthServerConfig, error::RpcError, IpcServerBuilder, RpcModuleConfig, RpcServerConfig, @@ -168,6 +168,13 @@ impl RethRpcServerConfig for RpcServerArgs { fn rpc_server_config(&self) -> RpcServerConfig { let mut config = RpcServerConfig::default().with_jwt_secret(self.rpc_secret_key()); + if self.http_api.is_some() && !self.http { + warn!( + target: "reth::cli", + "The --http.api flag is set but --http is not enabled. HTTP RPC API will not be exposed." + ); + } + if self.http { let socket_address = SocketAddr::new(self.http_addr, self.http_port); config = config