pub use config::ConfigError; use serde::Deserialize; #[derive(Deserialize)] pub struct ServerConfig { pub host: String, pub port: u16, } #[derive(Deserialize)] pub struct Config { pub server: ServerConfig, 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() } }