Skip to content

Commit

Permalink
feat: add ipc path to config (#4920)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Nov 8, 2023
1 parent 22a7f2b commit ccf792e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/reth/src/args/gas_price_oracle_args.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Args;

/// Parameters to configure Gas Price Oracle
#[derive(Debug, Args, PartialEq, Eq, Default)]
#[derive(Debug, Clone, Args, PartialEq, Eq, Default)]
#[command(next_help_heading = "Gas Price Oracle")]
pub struct GasPriceOracleArgs {
/// Number of recent blocks to check for gas price
Expand Down
14 changes: 10 additions & 4 deletions bin/reth/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
use crate::{
args::GasPriceOracleArgs,
cli::{components::RethRpcComponents, config::RethRpcConfig, ext::RethNodeCommandConfig},
cli::{
components::{RethNodeComponents, RethRpcComponents},
config::RethRpcConfig,
ext::RethNodeCommandConfig,
},
};
use clap::{
builder::{PossibleValue, RangedU64ValueParser, TypedValueParser},
Expand All @@ -24,8 +28,6 @@ use reth_rpc::{
},
JwtError, JwtSecret,
};

use crate::cli::components::RethNodeComponents;
use reth_rpc_builder::{
auth::{AuthServerConfig, AuthServerHandle},
constants,
Expand Down Expand Up @@ -55,7 +57,7 @@ pub(crate) const RPC_DEFAULT_MAX_RESPONSE_SIZE_MB: u32 = 115;
pub(crate) const RPC_DEFAULT_MAX_CONNECTIONS: u32 = 500;

/// Parameters for configuring the rpc more granularity via CLI
#[derive(Debug, Args)]
#[derive(Debug, Clone, Args)]
#[command(next_help_heading = "RPC")]
pub struct RpcServerArgs {
/// Enable the HTTP-RPC server
Expand Down Expand Up @@ -309,6 +311,10 @@ impl RethRpcConfig for RpcServerArgs {
!self.ipcdisable
}

fn ipc_path(&self) -> &str {
self.ipcpath.as_str()
}

fn eth_config(&self) -> EthConfig {
EthConfig::default()
.max_tracing_requests(self.rpc_max_tracing_requests)
Expand Down
3 changes: 3 additions & 0 deletions bin/reth/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub trait RethRpcConfig {
/// Returns whether ipc is enabled.
fn is_ipc_enabled(&self) -> bool;

/// Returns the path to the target ipc socket if enabled.
fn ipc_path(&self) -> &str;

/// The configured ethereum RPC settings.
fn eth_config(&self) -> EthConfig;

Expand Down
5 changes: 5 additions & 0 deletions crates/rpc/rpc-builder/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ impl AuthServerConfig {
AuthServerConfigBuilder::new(secret)
}

/// Returns the address the server will listen on.
pub fn address(&self) -> SocketAddr {
self.socket_addr
}

/// Convenience function to start a server in one step.
pub async fn start(self, module: AuthRpcModule) -> Result<AuthServerHandle, RpcError> {
let Self { socket_addr, secret, server_config } = self;
Expand Down

0 comments on commit ccf792e

Please sign in to comment.