blog/backend/src/config.rs

22 lines
477 B
Rust
Raw Normal View History

2023-02-07 06:02:51 +00:00
use envconfig::Envconfig;
use lazy_static::lazy_static;
#[derive(Envconfig, Debug)]
pub struct Config {
2023-02-11 11:48:39 +00:00
#[envconfig(from = "BACKEND_BIND_URL")]
pub bind_url: String,
2023-02-07 06:02:51 +00:00
#[envconfig(from = "BACKEND_DB_URL")]
pub db_url: String,
2023-02-11 11:48:39 +00:00
#[envconfig(from = "BACKEND_REDIS_URL")]
pub redis_url: String,
2023-02-12 08:18:56 +00:00
#[envconfig(from = "BACKEND_CACHE_TTL")]
pub cache_ttl: usize,
2023-02-07 06:02:51 +00:00
}
lazy_static! {
pub static ref CONFIG: Config = Config::init_from_env().unwrap();
}