summaryrefslogblamecommitdiff
path: root/src/config.rs
blob: a0dfbbe67c0e6e0614d6d42ea9ba81af48ad476f (plain) (tree)






















                                                         
use config::{Config, File, FileFormat};
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Cfg {
    pub apis: Apis,
}

#[derive(Debug, Deserialize)]
pub struct Apis {
    pub modrinth: String,
}

impl Cfg {
    pub fn init(path: &str) -> Self {
        Config::builder()
            .add_source(File::new(path, FileFormat::Ini))
            .build()
            .unwrap()
            .try_deserialize()
            .unwrap()
    }
}