From fc1cb1acc0dce412e948475002666bcd1d4b0348 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Mon, 31 Oct 2022 22:41:18 +0100 Subject: add first impl --- src/config.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/config.rs (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..a0dfbbe --- /dev/null +++ b/src/config.rs @@ -0,0 +1,23 @@ +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() + } +} -- cgit v1.2.3