From d1b1b4ef497c4819f3bdeb63119270d447088a05 Mon Sep 17 00:00:00 2001 From: cinco euzebio Date: Sun, 1 Mar 2026 04:07:31 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20update=5Fcheck=5Finte?= =?UTF-8?q?rval=5Fhours=20config=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `update_check_interval_hours: u64` (serde default 24, 0 = disabled) to Config struct, enabling periodic update check control via config file. --- src/config.rs | 9 +++++++++ tests/scan.rs | 1 + 2 files changed, 10 insertions(+) diff --git a/src/config.rs b/src/config.rs index bd11648..a6a2eac 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,6 +15,8 @@ pub struct Config { pub cache_enabled: bool, #[serde(default = "default_cache_ttl_hours")] pub cache_ttl_hours: u64, + #[serde(default = "default_update_check_interval_hours")] + pub update_check_interval_hours: u64, #[serde(default = "default_session_config")] pub default_session: SessionConfig, } @@ -31,6 +33,10 @@ fn default_cache_ttl_hours() -> u64 { 24 } +fn default_update_check_interval_hours() -> u64 { + 24 +} + fn default_session_config() -> SessionConfig { use crate::session::Window; @@ -109,6 +115,7 @@ impl Config { max_depth, cache_enabled, cache_ttl_hours, + update_check_interval_hours: default_update_check_interval_hours(), default_session: SessionConfig { windows }, }; @@ -229,6 +236,7 @@ impl Config { max_depth: 5, cache_enabled: true, cache_ttl_hours: 24, + update_check_interval_hours: default_update_check_interval_hours(), default_session: default_session_config(), } } @@ -245,6 +253,7 @@ mod tests { assert_eq!(config.max_depth, 5); assert!(config.cache_enabled); assert_eq!(config.cache_ttl_hours, 24); + assert_eq!(config.update_check_interval_hours, 24); } #[test] diff --git a/tests/scan.rs b/tests/scan.rs index 58280e2..578db21 100644 --- a/tests/scan.rs +++ b/tests/scan.rs @@ -10,6 +10,7 @@ fn make_config(max_depth: usize) -> Config { max_depth, cache_enabled: true, cache_ttl_hours: 24, + update_check_interval_hours: 24, default_session: SessionConfig { windows: vec![] }, } }