replace_home for password_files, reserved_peers and log_file (#8324)
* replace_home for password_files, reserved_peers and log_file * typo: arg_log_file is Option
This commit is contained in:
parent
d97cf34138
commit
431b27d3e1
@ -149,7 +149,7 @@ impl Configuration {
|
||||
if self.args.cmd_signer_new_token {
|
||||
Cmd::SignerToken(ws_conf, ui_conf, logger_config.clone())
|
||||
} else if self.args.cmd_signer_sign {
|
||||
let pwfile = self.args.arg_password.first().map(|pwfile| {
|
||||
let pwfile = self.accounts_config()?.password_files.first().map(|pwfile| {
|
||||
PathBuf::from(pwfile)
|
||||
});
|
||||
Cmd::SignerSign {
|
||||
@ -186,7 +186,7 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
path: dirs.keys,
|
||||
spec: spec,
|
||||
password_file: self.args.arg_password.first().map(|x| x.to_owned()),
|
||||
password_file: self.accounts_config()?.password_files.first().map(|x| x.to_owned()),
|
||||
};
|
||||
AccountCmd::New(new_acc)
|
||||
} else if self.args.cmd_account_list {
|
||||
@ -220,8 +220,8 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
path: dirs.keys,
|
||||
spec: spec,
|
||||
wallet_path: self.args.arg_wallet_import_path.unwrap().clone(),
|
||||
password_file: self.args.arg_password.first().map(|x| x.to_owned()),
|
||||
wallet_path: self.args.arg_wallet_import_path.clone().unwrap(),
|
||||
password_file: self.accounts_config()?.password_files.first().map(|x| x.to_owned()),
|
||||
};
|
||||
Cmd::ImportPresaleWallet(presale_cmd)
|
||||
} else if self.args.cmd_import {
|
||||
@ -456,7 +456,7 @@ impl Configuration {
|
||||
LogConfig {
|
||||
mode: self.args.arg_logging.clone(),
|
||||
color: !self.args.flag_no_color && !cfg!(windows),
|
||||
file: self.args.arg_log_file.clone(),
|
||||
file: self.args.arg_log_file.as_ref().map(|log_file| replace_home(&self.directories().base, log_file)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
refresh_time: self.args.arg_accounts_refresh,
|
||||
testnet: self.args.flag_testnet,
|
||||
password_files: self.args.arg_password.clone(),
|
||||
password_files: self.args.arg_password.iter().map(|s| replace_home(&self.directories().base, s)).collect(),
|
||||
unlocked_accounts: to_addresses(&self.args.arg_unlock)?,
|
||||
enable_hardware_wallets: !self.args.flag_no_hardware_wallets,
|
||||
enable_fast_unlock: self.args.flag_fast_unlock,
|
||||
@ -728,8 +728,10 @@ impl Configuration {
|
||||
|
||||
match self.args.arg_reserved_peers {
|
||||
Some(ref path) => {
|
||||
let path = replace_home(&self.directories().base, path);
|
||||
|
||||
let mut buffer = String::new();
|
||||
let mut node_file = File::open(path).map_err(|e| format!("Error opening reserved nodes file: {}", e))?;
|
||||
let mut node_file = File::open(&path).map_err(|e| format!("Error opening reserved nodes file: {}", e))?;
|
||||
node_file.read_to_string(&mut buffer).map_err(|_| "Error reading reserved node file")?;
|
||||
let lines = buffer.lines().map(|s| s.trim().to_owned()).filter(|s| !s.is_empty() && !s.starts_with("#")).collect::<Vec<_>>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user