aptu_core/config/
cache.rs1use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Deserialize, Serialize, Clone)]
9#[serde(default)]
10pub struct CacheConfig {
11 pub issue_ttl_minutes: i64,
13 pub repo_ttl_hours: i64,
15 pub curated_repos_url: String,
17 pub file_eviction_days: i64,
19}
20
21impl Default for CacheConfig {
22 fn default() -> Self {
23 Self {
24 issue_ttl_minutes: crate::cache::DEFAULT_ISSUE_TTL_MINS,
25 repo_ttl_hours: crate::cache::DEFAULT_REPO_TTL_HOURS,
26 curated_repos_url:
27 "https://raw.githubusercontent.com/clouatre-labs/aptu/main/data/curated-repos.json"
28 .to_string(),
29 file_eviction_days: 7,
30 }
31 }
32}
33
34impl CacheConfig {
35 pub fn validate(&self) -> Result<(), String> {
43 if self.file_eviction_days <= 0 {
44 return Err(format!(
45 "file_eviction_days must be > 0, got {}",
46 self.file_eviction_days
47 ));
48 }
49 Ok(())
50 }
51}
52
53#[derive(Debug, Deserialize, Serialize, Clone)]
55#[serde(default)]
56pub struct ReposConfig {
57 pub curated: bool,
59 #[serde(default)]
61 pub dco_signoff: bool,
62}
63
64impl Default for ReposConfig {
65 fn default() -> Self {
66 Self {
67 curated: true,
68 dco_signoff: false,
69 }
70 }
71}