1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[derive(Debug, Clone)] pub struct Config { pub bind_addr: String, pub issuer_url: String, } impl Config { pub fn from_env() -> Self { let bind_addr = std::env::var("BIND_ADDR").unwrap_or_else(|_| "127.0.0.1:7878".to_string()); let issuer_url = format!("http://{}", bind_addr); Self { bind_addr, issuer_url, } } }