Browse Source

Added CWD cfg file and fixed ordering of cfg files

The values in user-level config file should override system config file,
not the other way arounnd. Also added `electrs.toml` config file which
is searched for in the current directory.
master
Martin Habovstiak 6 years ago
parent
commit
268fbf5c09
  1. 7
      src/config.rs

7
src/config.rs

@ -143,8 +143,11 @@ impl Config {
let system_config: &OsStr = "/etc/electrs/config.toml".as_ref(); let system_config: &OsStr = "/etc/electrs/config.toml".as_ref();
let home_config = home_dir().map(|mut dir| { dir.push(".electrs/config.toml"); dir }); let home_config = home_dir().map(|mut dir| { dir.push(".electrs/config.toml"); dir });
let configs = std::iter::once(system_config) let cwd_config: &OsStr = "electrs.toml".as_ref();
.chain(home_config.as_ref().map(AsRef::as_ref)); let configs = std::iter::once(cwd_config)
.chain(home_config.as_ref().map(AsRef::as_ref))
.chain(std::iter::once(system_config));
let (mut config, _) = internal::Config::including_optional_config_files(configs).unwrap_or_exit(); let (mut config, _) = internal::Config::including_optional_config_files(configs).unwrap_or_exit();
let network_name = match config.network { let network_name = match config.network {

Loading…
Cancel
Save