2025-02-26 03:05:18 +01:00
|
|
|
|
|
|
|
#![allow(unused)]
|
|
|
|
|
2025-03-04 22:08:08 +01:00
|
|
|
use std::{collections::HashMap, fs::read_to_string};
|
2025-02-26 03:05:18 +01:00
|
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
mod daemon;
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
pub struct Config {
|
|
|
|
pub title: String,
|
|
|
|
pub daemon: daemon::Daemon,
|
|
|
|
pub source: HashMap<String, crate::source::Source>
|
|
|
|
}
|
2025-03-04 22:08:08 +01:00
|
|
|
|
|
|
|
impl Config {
|
|
|
|
pub fn parse(path: &str) -> Result<Config, Box<dyn std::error::Error>> {
|
|
|
|
Ok(toml::from_str::<Config>(&read_to_string(path)?)?)
|
|
|
|
}
|
|
|
|
}
|