mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-01 10:35:05 -05:00
feat: add ipc path to config (#4920)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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},
|
||||
@@ -24,8 +28,6 @@ use reth_rpc::{
|
||||
},
|
||||
JwtError, JwtSecret,
|
||||
};
|
||||
|
||||
use crate::cli::components::RethNodeComponents;
|
||||
use reth_rpc_builder::{
|
||||
auth::{AuthServerConfig, AuthServerHandle},
|
||||
constants,
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user