Added config support

This commit is contained in:
Connor Johnstone
2026-03-18 15:14:32 -04:00
parent ff41233a96
commit 32b4b533c0
11 changed files with 381 additions and 259 deletions

View File

@@ -240,10 +240,58 @@ pub struct SyncStats {
// --- Config ---
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AppConfig {
pub library_path: String,
pub database_url: String,
pub download_path: String,
pub organization_format: String,
#[serde(default)]
pub allowed_secondary_types: Vec<String>,
#[serde(default)]
pub web: WebConfigFe,
#[serde(default)]
pub tagging: TaggingConfigFe,
#[serde(default)]
pub download: DownloadConfigFe,
#[serde(default)]
pub indexing: IndexingConfigFe,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct WebConfigFe {
#[serde(default)]
pub port: u16,
#[serde(default)]
pub bind: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct TaggingConfigFe {
#[serde(default)]
pub auto_tag: bool,
#[serde(default)]
pub write_tags: bool,
#[serde(default)]
pub confidence: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct DownloadConfigFe {
#[serde(default)]
pub format: String,
#[serde(default)]
pub search_source: String,
#[serde(default)]
pub cookies_path: Option<String>,
#[serde(default)]
pub rate_limit: u32,
#[serde(default)]
pub rate_limit_auth: u32,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
pub struct IndexingConfigFe {
#[serde(default)]
pub concurrency: usize,
}