From 35688e4af7397086df3ada1721ceb9cd6c24ba7e Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Wed, 26 Feb 2025 13:17:08 -0500 Subject: [PATCH] fix: update default setting for removing default feeds --- app.json | 3 +++ src/config.rs | 5 +++++ src/instance_info.rs | 3 +++ 3 files changed, 11 insertions(+) diff --git a/app.json b/app.json index c05b26d..4af7cfe 100644 --- a/app.json +++ b/app.json @@ -76,6 +76,9 @@ }, "REDLIB_FULL_URL": { "required": false + }, + "REDLIB_DEFAULT_REMOVE_DEFAULT_FEEDS": { + "required": false } } } diff --git a/src/config.rs b/src/config.rs index 034afc7..7b1c95c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -109,6 +109,9 @@ pub struct Config { #[serde(rename = "REDLIB_FULL_URL")] pub(crate) full_url: Option, + + #[serde(rename = "REDLIB_DEFAULT_REMOVE_DEFAULT_FEEDS")] + pub(crate) default_remove_default_feeds: Option, } impl Config { @@ -156,6 +159,7 @@ impl Config { pushshift: parse("REDLIB_PUSHSHIFT_FRONTEND"), enable_rss: parse("REDLIB_ENABLE_RSS"), full_url: parse("REDLIB_FULL_URL"), + default_remove_default_feeds: parse("REDLIB_DEFAULT_REMOVE_DEFAULT_FEEDS"), } } } @@ -185,6 +189,7 @@ fn get_setting_from_config(name: &str, config: &Config) -> Option { "REDLIB_PUSHSHIFT_FRONTEND" => config.pushshift.clone(), "REDLIB_ENABLE_RSS" => config.enable_rss.clone(), "REDLIB_FULL_URL" => config.full_url.clone(), + "REDLIB_DEFAULT_REMOVE_DEFAULT_FEEDS" => config.default_remove_default_feeds.clone(), _ => None, } } diff --git a/src/instance_info.rs b/src/instance_info.rs index 5f82ce6..a573953 100644 --- a/src/instance_info.rs +++ b/src/instance_info.rs @@ -128,6 +128,7 @@ impl InstanceInfo { ["Pushshift frontend", &convert(&self.config.pushshift)], ["RSS enabled", &convert(&self.config.enable_rss)], ["Full URL", &convert(&self.config.full_url)], + ["Remove default feeds", &convert(&self.config.default_remove_default_feeds)], //TODO: fallback to crate::config::DEFAULT_PUSHSHIFT_FRONTEND ]) .with_header_row(["Settings"]), @@ -169,6 +170,7 @@ impl InstanceInfo { Pushshift frontend: {:?}\n RSS enabled: {:?}\n Full URL: {:?}\n + Remove default feeds: {:?}\n Config:\n Banner: {:?}\n Hide awards: {:?}\n @@ -195,6 +197,7 @@ impl InstanceInfo { self.config.sfw_only, self.config.enable_rss, self.config.full_url, + self.config.default_remove_default_feeds, self.config.pushshift, self.config.banner, self.config.default_hide_awards,