diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/config.rs b/src/config.rs index a5652c1..fa3dfba 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,13 +5,8 @@ use serde::Deserialize; #[derive(Deserialize)] pub struct Config { + pub subscriptions_path: Option<String>, #[serde(default)] - pub urls: Vec<String>, - pub channel: ChannelConfig, -} - -#[derive(Deserialize)] -pub struct ChannelConfig { pub title: String, pub link: String, pub description: String, @@ -40,12 +35,12 @@ pub struct ChannelConfig { pub fn default_config_file_locations() -> Vec<String> { let mut default_config_file_locations = vec![ - String::from("/etc/rss-aggregator.toml"), + String::from("/etc/rss-aggregator/config.toml"), ]; let config_dir = dirs::config_dir() .and_then(|config_dir| config_dir.into_string().ok()); if let Some(config_dir) = config_dir { - default_config_file_locations.push(format!("{config_dir}/rss-aggregator.toml")); + default_config_file_locations.push(format!("{config_dir}/rss-aggregator/config.toml")); }; default_config_file_locations } @@ -58,10 +53,10 @@ impl Config { Ok(toml::from_str(&contents)?) } - pub fn find_config() -> Option<Config> { + pub fn find_config() -> Option<(Config, String)> { for path in default_config_file_locations() { if let Ok(config) = Self::parse_config_file_at_path(&path) { - return Some(config); + return Some((config, path)); }; }; None |
