use serde::Deserialize; use std::{error::Error, fs}; #[derive(Deserialize)] pub struct Config { pub auth: Auth, #[serde(rename = "entry")] pub entries: Vec, } #[derive(Deserialize)] pub struct Auth { pub key: String, pub secret_key: String, } #[derive(Deserialize)] pub struct Entry { pub domain: String, pub subdomains: Vec, } pub fn load(path: &str) -> Result> { let raw = fs::read_to_string(&path)?; let config = toml::from_str(&raw)?; Ok(config) }