✨ feat(cli): load configurations from toml file
- load configurations from `cull-gmail.toml` - set default value for rules in config
This commit is contained in:
committed by
Jeremiah Russell
parent
1ae34efb93
commit
44b98d0657
@@ -87,12 +87,13 @@ fn get_logging(level: log::LevelFilter) -> env_logger::Builder {
|
||||
|
||||
fn get_config() -> Result<ClientConfig> {
|
||||
let home_dir = env::home_dir().unwrap();
|
||||
let path = home_dir.join(".cull-gmail/rules.toml");
|
||||
log::trace!("Loading config from {}", path.display());
|
||||
let path = home_dir.join(".cull-gmail/cull-gmail.toml");
|
||||
log::info!("Loading config from {}", path.display());
|
||||
|
||||
let configurations = config::Config::builder()
|
||||
.set_default("credentials", "credential.json")?
|
||||
.set_default("config_root", "h:.cull-gmail")?
|
||||
.set_default("rules", "rules.toml")?
|
||||
// Add in `./Settings.toml`
|
||||
.add_source(config::File::with_name(
|
||||
path.to_path_buf().to_str().unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user