summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-07-29 16:53:42 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-07-29 16:53:42 +0200
commit7f3f9f0bf18ba9c48b7b62d4825a2932b6b0c68d (patch)
treeaaa1a67935e8a129db43007716a5b92d04326682 /src/config.rs
parentb5256b0f78a91101f19c6ffdf462e06d05d5c2ad (diff)
feat: make login
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..83ed7bd
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,16 @@
+pub use config::ConfigError;
+use serde::Deserialize;
+
+#[derive(Deserialize, Debug)]
+pub struct Config {
+ pub cf: String,
+ pub password: String,
+}
+
+impl Config {
+ pub fn from_env() -> Result<Self, ConfigError> {
+ let mut cfg = config::Config::new();
+ cfg.merge(config::Environment::new())?;
+ cfg.try_into()
+ }
+}