dotfiles/sync-runner/src/cfg/mod.rs
2025-03-04 22:08:08 +01:00

21 lines
460 B
Rust

#![allow(unused)]
use std::{collections::HashMap, fs::read_to_string};
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>
}
impl Config {
pub fn parse(path: &str) -> Result<Config, Box<dyn std::error::Error>> {
Ok(toml::from_str::<Config>(&read_to_string(path)?)?)
}
}