fix: rpc port override (#65)
This commit is contained in:
parent
8844f921e8
commit
edfa536987
|
@ -74,8 +74,8 @@ fn get_config() -> Config {
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[clap(short, long, default_value = "mainnet")]
|
#[clap(short, long, default_value = "mainnet")]
|
||||||
network: String,
|
network: String,
|
||||||
#[clap(short, long, env)]
|
#[clap(short = 'p', long, env)]
|
||||||
port: Option<u16>,
|
rpc_port: Option<u16>,
|
||||||
#[clap(short = 'w', long, env)]
|
#[clap(short = 'w', long, env)]
|
||||||
checkpoint: Option<String>,
|
checkpoint: Option<String>,
|
||||||
#[clap(short, long, env)]
|
#[clap(short, long, env)]
|
||||||
|
@ -96,7 +96,7 @@ impl Cli {
|
||||||
execution_rpc: self.execution_rpc.clone(),
|
execution_rpc: self.execution_rpc.clone(),
|
||||||
consensus_rpc: self.consensus_rpc.clone(),
|
consensus_rpc: self.consensus_rpc.clone(),
|
||||||
data_dir: self.get_data_dir(),
|
data_dir: self.get_data_dir(),
|
||||||
port: self.port,
|
rpc_port: self.rpc_port,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ impl Config {
|
||||||
|
|
||||||
let base_provider = Serialized::from(base_config, network);
|
let base_provider = Serialized::from(base_config, network);
|
||||||
let toml_provider = Toml::file(config_path).nested();
|
let toml_provider = Toml::file(config_path).nested();
|
||||||
let user_provider = cli_config.as_provider(network);
|
let cli_provider = cli_config.as_provider(network);
|
||||||
|
|
||||||
let config_res = Figment::new()
|
let config_res = Figment::new()
|
||||||
.merge(base_provider)
|
.merge(base_provider)
|
||||||
.merge(toml_provider)
|
.merge(toml_provider)
|
||||||
.merge(user_provider)
|
.merge(cli_provider)
|
||||||
.select(network)
|
.select(network)
|
||||||
.extract();
|
.extract();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ pub struct CliConfig {
|
||||||
pub execution_rpc: Option<String>,
|
pub execution_rpc: Option<String>,
|
||||||
pub consensus_rpc: Option<String>,
|
pub consensus_rpc: Option<String>,
|
||||||
pub checkpoint: Option<Vec<u8>>,
|
pub checkpoint: Option<Vec<u8>>,
|
||||||
pub port: Option<u16>,
|
pub rpc_port: Option<u16>,
|
||||||
pub data_dir: PathBuf,
|
pub data_dir: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ impl CliConfig {
|
||||||
user_dict.insert("checkpoint", Value::from(hex::encode(checkpoint)));
|
user_dict.insert("checkpoint", Value::from(hex::encode(checkpoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(port) = self.port {
|
if let Some(port) = self.rpc_port {
|
||||||
user_dict.insert("port", Value::from(port));
|
user_dict.insert("rpc_port", Value::from(port));
|
||||||
}
|
}
|
||||||
|
|
||||||
user_dict.insert("data_dir", Value::from(self.data_dir.to_str().unwrap()));
|
user_dict.insert("data_dir", Value::from(self.data_dir.to_str().unwrap()));
|
||||||
|
|
Loading…
Reference in New Issue