diff options
author | fxqnlr <[email protected]> | 2022-10-31 22:41:18 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2022-10-31 22:41:18 +0100 |
commit | fc1cb1acc0dce412e948475002666bcd1d4b0348 (patch) | |
tree | 6b7667b453af8f2065681fa4dd850b0675b7bbde /src/config.rs | |
parent | 3320da719669f37dd5f55693b4d76edb27dbce02 (diff) | |
download | modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar.gz modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.zip |
add first impl
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 23 |
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 @@ | |||
1 | use config::{Config, File, FileFormat}; | ||
2 | use serde::Deserialize; | ||
3 | |||
4 | #[derive(Debug, Deserialize)] | ||
5 | pub struct Cfg { | ||
6 | pub apis: Apis, | ||
7 | } | ||
8 | |||
9 | #[derive(Debug, Deserialize)] | ||
10 | pub struct Apis { | ||
11 | pub modrinth: String, | ||
12 | } | ||
13 | |||
14 | impl 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 | } | ||