vls_util/
env_var.rs

1use std::env;
2
3pub fn deployment_environment() -> String {
4    env::var("DEPLOYMENT_ENV").unwrap_or("DEVELOPMENT".to_string())
5}
6
7pub fn otlp_endpoint() -> Option<String> {
8    env::var("OLTP_ENDPOINT").ok()
9}
10
11pub fn otlp_timeout() -> u64 {
12    env::var("OLTP_TIMEOUT")
13        .unwrap_or("3".to_string())
14        .parse()
15        .expect("OLTP Exporter timeout value needs to be a positive number")
16}
17
18pub fn compare_env_var(key: &str, value: &str) -> bool {
19    match env::var(key) {
20        Ok(val) => val == value,
21        Err(_) => false,
22    }
23}