vls_proxy/util/
env_var.rs

1use std::env;
2
3pub fn bitcoind_rpc_url() -> String {
4    env::var("BITCOIND_RPC_URL").expect("env var BITCOIND_RPC_URL")
5}
6
7pub fn vls_network() -> String {
8    env::var("VLS_NETWORK").expect("env var VLS_NETWORK")
9}
10
11pub fn vls_cln_version() -> String {
12    env::var("VLS_CLN_VERSION").expect("set VLS_CLN_VERSION to match c-lightning")
13}
14
15pub fn deployment_environment() -> String {
16    env::var("DEPLOYMENT_ENV").unwrap_or("DEVELOPMENT".to_string())
17}
18
19pub fn otlp_endpoint() -> String {
20    env::var("OLTP_ENDPOINT").unwrap_or("http://localhost:4317".to_string())
21}
22
23pub fn otlp_timeout() -> u64 {
24    env::var("OLTP_TIMEOUT")
25        .unwrap_or("3".to_string())
26        .parse()
27        .expect("OLTP Exporter timeout value needs to be a positive number")
28}
29
30pub fn txoo_source_url() -> Option<String> {
31    env::var("TXOO_SOURCE_URL").ok()
32}
33
34pub fn compare_env_var(key: &str, value: &str) -> bool {
35    match env::var(key) {
36        Ok(val) => val == value,
37        Err(_) => false,
38    }
39}