starting phase 5; clap cli

This commit is contained in:
2026-08-17 18:02:47 +01:00
parent 338e6c830a
commit 06886a2286
7 changed files with 252 additions and 5 deletions
+15
View File
@@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::Path;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
@@ -28,6 +29,20 @@ impl Default for Config {
}
}
impl Config {
pub fn load(path: &Path) -> anyhow::Result<Self> {
if path.exists() {
let contents = std::fs::read_to_string(path)?;
let config: Config = serde_json::from_str(&contents)?;
tracing::info!("Loaded config from {}", path.display());
Ok(config)
} else {
tracing::warn!("Config file {} not found, using defaults", path.display());
Ok(Self::default())
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct MetadataResponse {
#[serde(default)]