3a287b864a
- Upgrade to rust 2018 - Update dependencies - Use BTree{Map,Set} instead of Map and Set
18 lines
479 B
Rust
18 lines
479 B
Rust
use crate::common::*;
|
|
|
|
pub fn load_dotenv() -> RunResult<'static, BTreeMap<String, String>> {
|
|
match dotenv::dotenv_iter() {
|
|
Ok(iter) => {
|
|
let result: dotenv::Result<BTreeMap<String, String>> = iter.collect();
|
|
result.map_err(|dotenv_error| RuntimeError::Dotenv { dotenv_error })
|
|
}
|
|
Err(dotenv_error) => {
|
|
if dotenv_error.not_found() {
|
|
Ok(BTreeMap::new())
|
|
} else {
|
|
Err(RuntimeError::Dotenv { dotenv_error })
|
|
}
|
|
}
|
|
}
|
|
}
|