-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-thinking: Config source: clap #328
Comments
I built a lib serfig which powered by serde-bridge to make it possible. The real use-case: pub fn load() -> Result<Self> {
let arg_conf: Self = Config::parse();
let mut builder: serfig::Builder<Self> = serfig::Builder::default();
// Load from config file first.
{
let config_file = if !arg_conf.config_file.is_empty() {
arg_conf.config_file.clone()
} else if let Ok(path) = env::var("CONFIG_FILE") {
path
} else {
"".to_string()
};
builder = builder.collect(from_file(Toml, &config_file));
}
// Then, load from env.
builder = builder.collect(from_env());
// Finally, load from args.
builder = builder.collect(from_self(arg_conf));
Ok(builder.build()?)
} Hoping these can help |
Native support for At the moment we do all this merging by hand, but |
I also agree with this demand, and this demand still has great prospects. |
+1 on this feature! |
Closing this in favor of #64 so we don't split the conversation any further. |
Do we want to support clap as a source of configuration?
This is of lower importance. First we must decide on #323
The text was updated successfully, but these errors were encountered: