mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
dep: rm confy as a dep (#10290)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
@ -58,7 +58,6 @@ secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recov
|
||||
|
||||
# io
|
||||
fdlimit.workspace = true
|
||||
confy.workspace = true
|
||||
toml = { workspace = true, features = ["display"] }
|
||||
|
||||
# tui
|
||||
|
||||
@ -65,7 +65,8 @@ impl EnvironmentArgs {
|
||||
}
|
||||
|
||||
let config_path = self.config.clone().unwrap_or_else(|| data_dir.config());
|
||||
let mut config: Config = confy::load_path(config_path)
|
||||
|
||||
let mut config = Config::from_path(config_path)
|
||||
.inspect_err(
|
||||
|err| warn!(target: "reth::cli", %err, "Failed to load config file, using default"),
|
||||
)
|
||||
|
||||
@ -25,11 +25,12 @@ impl Command {
|
||||
Config::default()
|
||||
} else {
|
||||
let path = self.config.clone().unwrap_or_default();
|
||||
// confy will create the file if it doesn't exist; we don't want this
|
||||
// Check if the file exists
|
||||
if !path.exists() {
|
||||
bail!("Config file does not exist: {}", path.display());
|
||||
}
|
||||
confy::load_path::<Config>(&path)
|
||||
// Read the configuration file
|
||||
Config::from_path(&path)
|
||||
.wrap_err_with(|| format!("Could not load config file: {}", path.display()))?
|
||||
};
|
||||
println!("{}", toml::to_string_pretty(&config)?);
|
||||
|
||||
@ -74,13 +74,15 @@ pub enum Subcommands {
|
||||
// RLPx utilities
|
||||
Rlpx(rlpx::Command),
|
||||
}
|
||||
|
||||
impl Command {
|
||||
/// Execute `p2p` command
|
||||
pub async fn execute(self) -> eyre::Result<()> {
|
||||
let data_dir = self.datadir.clone().resolve_datadir(self.chain.chain);
|
||||
let config_path = self.config.clone().unwrap_or_else(|| data_dir.config());
|
||||
|
||||
let mut config: Config = confy::load_path(&config_path).unwrap_or_default();
|
||||
// Load configuration
|
||||
let mut config = Config::from_path(&config_path).unwrap_or_default();
|
||||
|
||||
config.peers.trusted_nodes.extend(self.network.trusted_peers.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user