Description
Currently, the hilo-node's cli args are directly transformed into the hilo-node Config. Instead, the node binary should use Figment to attempt to read environment variables, then the toml file, and lastly the CLI args to build the Config.
This could look like the following.
use hilo_node::Config;
use figment::{Figment, providers::{Serialized, Env, Toml}};
let cli = NodeArgs.parse()?;
let toml_file = cli.static-config; // This can be a cli arg, so you can do `node --static-config hilo.toml`
let defaults_provider = Serialized::defaults(DefaultsProvider::default());
let toml_provider = Toml::file(toml_file).nested();
let cli_provider = Serialized::defaults(cli);
let config: Config = Figment::new()
.merge(defaults_provider)
.merge(Env::prefixed("HILO_"))
.merge(toml_provider)
.merge(cli_provider)
.extract()?;
Note, the CliArgs should be modified to make arguments optional.
Description
Currently, the
hilo-node's cli args are directly transformed into thehilo-nodeConfig. Instead, thenodebinary should use Figment to attempt to read environment variables, then the toml file, and lastly the CLI args to build theConfig.This could look like the following.
Note, the
CliArgsshould be modified to make arguments optional.