1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-28 08:00:04 +08:00

add util_env

This commit is contained in:
2019-08-15 07:12:51 +08:00
parent 29e719477f
commit b15ea1aa7b
2 changed files with 10 additions and 0 deletions

9
src/util_env.rs Normal file
View File

@@ -0,0 +1,9 @@
use std::env;
pub fn is_env_on(var: &str) -> bool {
match env::var(var) {
Err(_) => false,
Ok(v) => (v == "TRUE" || v == "true" || v =="YES" || v == "yes" || v == "1"),
}
}