summaryrefslogtreecommitdiff
path: root/dichroism/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dichroism/src/config.rs')
-rw-r--r--dichroism/src/config.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/dichroism/src/config.rs b/dichroism/src/config.rs
index c1c42f0..0dbc10e 100644
--- a/dichroism/src/config.rs
+++ b/dichroism/src/config.rs
@@ -1,5 +1,6 @@
use crate::constants::DEFAULT_CONFIG;
use crate::result::Result;
+use once_cell::sync::Lazy;
use serde::Deserialize;
use std::env::var;
use std::fs::File;
@@ -7,6 +8,13 @@ use std::io::prelude::*;
use std::net::SocketAddr;
use toml::from_str;
+pub static CONFIG_INSTANCE: Lazy<Config> = Lazy::new(|| {
+ Config::from_toml().unwrap_or_else(|e| {
+ eprintln!("Error: {}", e.to_string());
+ std::process::exit(1);
+ })
+});
+
#[derive(Debug, Clone, Deserialize)]
pub struct Config {
pub db_url: String,