From 99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Thu, 22 Oct 2020 17:44:38 -0400 Subject: Added product migration, better organization of DTOs, Entities, and Domain Models. Also made config loading/photo generation easier. --- dichroism/src/config.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'dichroism/src/config.rs') 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 = 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, -- cgit v1.2.3