From 4b48bb90e3def4536fc4861290e90bb1720192ec Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Sun, 6 Sep 2026 21:13:01 +0100 Subject: separates config from subscriptions --- src/config.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/config.rs') 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, #[serde(default)] - pub urls: Vec, - 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 { 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 { + 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 -- cgit v1.2.3