starchart/src/config.rs

19 lines
450 B
Rust

use once_cell::sync::Lazy;
use serde_derive::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Config {
pub db_url: String,
}
pub static CONFIG: Lazy<Config> =
Lazy::new(|| confy::load("starchart", Some("config")).expect("failed to load config"));
impl Default for Config {
fn default() -> Self {
Self {
db_url: "postgres://starchart:hunter2@localhost/starchart".to_string(),
}
}
}