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

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

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