Added /blog/edit, inline documentation

This commit is contained in:
Leonard Lorenz 2020-10-26 12:17:52 +01:00
parent a90ca863e7
commit 6e72cba14c
4 changed files with 52 additions and 7 deletions

View file

@ -1,5 +1,8 @@
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 {