Used the config-rs crate to allow reading from a config file from /etc/zealot/config.toml and from the home directory
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
12
src/settings.rs
Normal file
12
src/settings.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use config::Config;
|
||||
|
||||
pub fn load_config() -> Config {
|
||||
let settings = Config::builder()
|
||||
// Add in `./Settings.toml`
|
||||
.add_source(config::File::with_name("/etc/zealot/config.toml").required(false))
|
||||
.add_source(config::File::with_name(&shellexpand::tilde("~/.config/zealot.toml")).required(false))
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
return settings;
|
||||
}
|
Reference in New Issue
Block a user