2018-03-05 13:21:35 -08:00
|
|
|
use common::*;
|
|
|
|
|
|
|
|
use dotenv;
|
|
|
|
|
|
|
|
pub fn load_dotenv() -> RunResult<'static, Map<String, String>> {
|
|
|
|
match dotenv::dotenv_iter() {
|
|
|
|
Ok(iter) => {
|
|
|
|
let result: dotenv::Result<Map<String, String>> = iter.collect();
|
2018-12-08 14:29:41 -08:00
|
|
|
result.map_err(|dotenv_error| RuntimeError::Dotenv { dotenv_error })
|
2018-03-05 13:21:35 -08:00
|
|
|
}
|
2018-12-08 14:29:41 -08:00
|
|
|
Err(dotenv_error) => {
|
|
|
|
if dotenv_error.not_found() {
|
|
|
|
Ok(Map::new())
|
|
|
|
} else {
|
|
|
|
Err(RuntimeError::Dotenv { dotenv_error })
|
|
|
|
}
|
2018-03-05 13:21:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|