use config::{Config, ConfigError, File}; use geoffrey_models::models::settings::GeoffreySettings; use serde::Deserialize; use std::path::{Path, PathBuf}; #[derive(Debug, Deserialize, Clone)] pub struct GeoffreyAPIConfig { pub server_config: ServerConfig, pub geoffrey_settings: GeoffreySettings, } #[derive(Debug, Deserialize, Clone)] pub struct ServerConfig { pub db_path: PathBuf, pub host: String, pub local_socket: Option, } impl GeoffreyAPIConfig { pub fn new(config_path: &Path) -> Result { let mut cfg = Config::new(); cfg.merge(File::from(config_path.to_path_buf()))?; cfg.try_into() } }