diff --git a/README.md b/README.md index ca06eba6b38c..22c26163e815 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,12 @@ bootstrap_peers = [""] Example of a [multiaddress](https://github.com/multiformats/multiaddr): `"/ip4/54.186.82.90/tcp/1347/p2p/12D3K1oWKNF7vNFEhnvB45E9mw2B5z6t419W3ziZPLdUDVnLLKGs"` +Forest will look for config files in the following order and priority: + * Paths passed to the command line via the `--config` flag. + * The environment variable `FOREST_CONFIG_PATH`, if no config was passed through command line arguments. + * If none of the above are found, Forest will look in the systems default configuration directory (`$XDG_CONFIG_HOME` on Linux systems). + * After all locations are exhausted and a config file is not found, a default configuration is assumed and used. + ### Logging The Forest logger uses [Rust's log filtering options](https://doc.rust-lang.org/1.1.0/log/index.html#filtering-results) with the `RUST_LOG` environment variable. diff --git a/forest/src/cli/mod.rs b/forest/src/cli/mod.rs index 59adbe063716..eb70efd78244 100644 --- a/forest/src/cli/mod.rs +++ b/forest/src/cli/mod.rs @@ -160,10 +160,7 @@ impl CliOpts { // Parse and return the configuration file read_toml(&toml)? } - None => match find_default_config() { - Some(cfg) => cfg, - None => Config::default(), - }, + None => find_default_config().unwrap_or_default(), }; if let Some(genesis_file) = &self.genesis { cfg.genesis_file = Some(genesis_file.to_owned());