refactor: Add boolean configuration helper and streamline host tag retrieval
This commit is contained in:
1 file changed
+3
-5
+3
-5
@@ -352,13 +352,11 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_host_tag() -> String {
|
fn get_bool(env_key: &str, uci_key: &str, default: Option<bool>) -> Result<bool, ConfigError> {
|
||||||
if let Ok(val) = env::var("SQMA_OBSERVABILITY_HOST_TAG") {
|
Self::get::<FlexiBool>(env_key, uci_key, default.map(FlexiBool)).map(|f| f.0)
|
||||||
if !val.is_empty() {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_host_tag() -> String {
|
||||||
// rustix can give us the hostname without shelling out
|
// rustix can give us the hostname without shelling out
|
||||||
rustix::system::uname()
|
rustix::system::uname()
|
||||||
.nodename()
|
.nodename()
|
||||||
|
|||||||
Reference in new issue
Block a user