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

This commit is contained in:
2022-09-15 18:10:42 -04:00
parent 0b6fb8a4f8
commit 024e4b2e1c
5 changed files with 25 additions and 46 deletions

12
src/settings.rs Normal file
View 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;
}