summaryrefslogtreecommitdiff
path: root/dichroism/src/config.rs
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-10-22 17:44:38 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-10-22 17:44:38 -0400
commit99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac (patch)
tree15e19324332173405fc7544af2c17195d7b05ff1 /dichroism/src/config.rs
parent76a782599b4ecc4ecb9b0ce7acc6420ed9e1ec8e (diff)
downloadtheglassyladies-99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac.tar.xz
theglassyladies-99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac.zip
Added product migration, better organization of DTOs, Entities, and
Domain Models. Also made config loading/photo generation easier.
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,