From 032f031f014c30049340bbb9f7d708bbf558ac3f Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 9 Mar 2021 20:53:47 +0100 Subject: feat: add config module --- src/config.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/config.rs (limited to 'src') diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..f10fd08 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,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 { + let mut cfg = config::Config::new(); + cfg.merge(config::Environment::new())?; + cfg.try_into() + } +} -- cgit v1.2.3-18-g5258