mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-22 04:19:47 -05:00
refactor(config): remove environment variable prefix
This commit is contained in:
parent
411f278656
commit
97f47a5a42
1 changed files with 2 additions and 5 deletions
|
@ -61,7 +61,7 @@ impl Config {
|
||||||
let mut config = config::Config::default();
|
let mut config = config::Config::default();
|
||||||
config
|
config
|
||||||
.merge(config::File::with_name(file_name))?
|
.merge(config::File::with_name(file_name))?
|
||||||
.merge(config::Environment::with_prefix(env!("CARGO_PKG_NAME")).separator("__"))?;
|
.merge(config::Environment::new().separator("__"))?;
|
||||||
config.try_into()
|
config.try_into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,10 +78,7 @@ mod test {
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
env::set_var(
|
env::set_var("SERVER__ADDRESS", "0.0.1.1");
|
||||||
format!("{}_SERVER__ADDRESS", env!("CARGO_PKG_NAME")),
|
|
||||||
"0.0.1.1",
|
|
||||||
);
|
|
||||||
let config = Config::parse(&file_name)?;
|
let config = Config::parse(&file_name)?;
|
||||||
assert_eq!("0.0.1.1", config.server.address);
|
assert_eq!("0.0.1.1", config.server.address);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue