Global configuration, templates load once, render many times

This commit is contained in:
Leonard Lorenz 2020-11-21 20:51:32 +01:00
parent 74ab125243
commit 7becde6dc7
15 changed files with 300 additions and 120 deletions

View file

@ -1,15 +0,0 @@
use std::string::String;
/// gets a value from an environment variable and returns it.
/// if this call was mandatory and it couldn't get a value, it will exit
/// the program and write an error message.
pub fn get_from_env(variable: &str, mandatory: bool) -> String {
std::env::var(variable).unwrap_or_else(|_| {
if mandatory {
println!("Error, couldn't read environment variable: {}", variable);
std::process::exit(1);
} else {
panic!("Error, couldn't read environment variable: {}", variable);
}
})
}