aboutsummaryrefslogblamecommitdiff
path: root/src/config.rs
blob: 29145b8166271f2a68c28333b337b301a0f27f88 (plain) (tree)


























                                                                          
use serde::Deserialize;
use std::path::PathBuf;

#[derive(Deserialize, Debug)]
pub struct Config {
    pub to: String,
    pub from: String,
    pub account_sid: String,
    pub auth_token: String,
    pub reboot: RebootConfig,
    pub hello: HelloConfig,
}

#[derive(Deserialize, Debug)]
pub struct RebootConfig {
    pub ifname: String,
}

#[derive(Deserialize, Debug)]
pub struct HelloConfig {}

impl Config {
    pub fn load_from_file(filename: &PathBuf) -> std::io::Result<Config> {
        let content = std::fs::read_to_string(filename)?;
        Ok(toml::from_str(&content)?)
    }
}