summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2022-10-31 22:41:18 +0100
committerfxqnlr <[email protected]>2022-10-31 22:41:18 +0100
commitfc1cb1acc0dce412e948475002666bcd1d4b0348 (patch)
tree6b7667b453af8f2065681fa4dd850b0675b7bbde /src/config.rs
parent3320da719669f37dd5f55693b4d76edb27dbce02 (diff)
downloadmodlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar
modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar.gz
modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.zip
add first impl
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}