[][src]Macro itconfig::env_or

macro_rules! env_or {
    ($env_name:expr) => { ... };
    ($env_name:expr, $default:expr) => { ... };
    ($($tokens:tt)*) => { ... };
}

This macro returns environment variable by name and converts variable to desired type or returns default value.

Panics

If you don't pass default value, macro will panic

Examples

let url: String = env_or!("DATABASE_URL", "127.0.0.1".to_string());
assert_eq!(url, "127.0.0.1".to_string());