summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs23
1 files changed, 23 insertions, 0 deletions
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 @@
1use config::{Config, File, FileFormat};
2use serde::Deserialize;
3
4#[derive(Debug, Deserialize)]
5pub struct Cfg {
6 pub apis: Apis,
7}
8
9#[derive(Debug, Deserialize)]
10pub struct Apis {
11 pub modrinth: String,
12}
13
14impl Cfg {
15 pub fn init(path: &str) -> Self {
16 Config::builder()
17 .add_source(File::new(path, FileFormat::Ini))
18 .build()
19 .unwrap()
20 .try_deserialize()
21 .unwrap()
22 }
23}