comment_app_backend/
lib.rs1use std::collections::HashMap;
5use lazy_static::*;
6use config::{Config, File, FileFormat};
7
8mod db;
9pub mod log;
10pub mod models;
11pub mod filters;
12pub mod handlers;
13pub mod utils;
14pub mod comment_server;
15
16lazy_static!{
18 static ref SETTINGS: HashMap<String, String> = get_settings();
19}
20
21fn get_settings() -> HashMap<String, String> {
23 let mut config = Config::default();
24 config.merge(File::new("Settings", FileFormat::Toml)).unwrap();
25 let settings = config.try_into::<HashMap<String, String>>().unwrap(); settings
27}
28
29pub fn config(key: &str) -> String {
30 SETTINGS.get(key).unwrap().to_string()
31}