summaryrefslogtreecommitdiff
path: root/src/config.rs
blob: 668dda78c21ee63f24cf19175d7dc031f59499ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub use config::ConfigError;
use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct Config {
    pub cf: String,
    pub password: String,
    pub driver_url: String,
    pub username: String,
}

impl Config {
    pub fn from_env() -> Result<Self, ConfigError> {
        let mut cfg = config::Config::new();
        cfg.merge(config::Environment::new())?;
        cfg.try_into()
    }
}