use anyhow::Result; #[derive(Debug, Clone)] pub struct DaemonConfig { pub bind: String, } pub fn load_config() -> Result { let bind = std::env::var("SECRETS_DAEMON_BIND").unwrap_or_else(|_| "127.0.0.1:9515".to_string()); if bind.trim().is_empty() { anyhow::bail!("SECRETS_DAEMON_BIND must not be empty"); } Ok(DaemonConfig { bind }) } pub fn load_persisted_device_token() -> Result> { let token = std::env::var("SECRETS_DEVICE_LOGIN_TOKEN") .ok() .map(|value| value.trim().to_string()) .filter(|value| !value.is_empty()); Ok(token) }