Global configuration, templates load once, render many times
This commit is contained in:
parent
74ab125243
commit
7becde6dc7
15 changed files with 300 additions and 120 deletions
|
@ -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);
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue