Improve configuration
This commit is contained in:
parent
71498256f6
commit
ace4face5a
9 changed files with 66 additions and 51 deletions
emgauwa-lib/src
|
@ -49,9 +49,12 @@ pub fn load<T>(config_name: &str, env_prefix: &str) -> Result<T, EmgauwaError>
|
|||
where
|
||||
for<'de> T: serde::Deserialize<'de>,
|
||||
{
|
||||
let etc_file =
|
||||
config::File::with_name(&format!("/etc/emgauwa/{}", config_name)).required(false);
|
||||
let local_file = config::File::with_name(&format!("./emgauwa-{}", config_name)).required(false);
|
||||
|
||||
config::Config::builder()
|
||||
.add_source(etc_file)
|
||||
.add_source(local_file)
|
||||
.add_source(
|
||||
config::Environment::with_prefix(&format!("EMGAUWA_{}", env_prefix))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue