From 7d5c2f0275be7ab6d3363a433572a11959f36189 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Wed, 22 Apr 2026 16:54:52 +0700 Subject: [PATCH] refactor: Add boolean configuration helper and streamline host tag retrieval --- src/config.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index 0b070ea..5ee5b83 100644 --- a/src/config.rs +++ b/src/config.rs @@ -352,13 +352,11 @@ impl Config { } } - fn get_host_tag() -> String { - if let Ok(val) = env::var("SQMA_OBSERVABILITY_HOST_TAG") { - if !val.is_empty() { - return val; - } - } + fn get_bool(env_key: &str, uci_key: &str, default: Option) -> Result { + Self::get::(env_key, uci_key, default.map(FlexiBool)).map(|f| f.0) + } + fn get_host_tag() -> String { // rustix can give us the hostname without shelling out rustix::system::uname() .nodename()