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

#[derive(Deserialize)]
pub struct Config {
    pub pg: deadpool_postgres::Config,
}

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