refactor(agent): drop vestigial install_configured param, non_empty_env helper, explicit infallible expect in client
This commit is contained in:
parent
9cebc128e2
commit
f2f104627d
4 changed files with 14 additions and 15 deletions
|
|
@ -14,14 +14,18 @@ pub fn label() -> String {
|
|||
env::var("HIVE_LABEL").unwrap_or_default()
|
||||
}
|
||||
|
||||
/// `env::var(key)` reduced to `Some(value)` only when the var is set and
|
||||
/// non-empty — the shared shape of the hive/swarm display-name lookups below.
|
||||
fn non_empty_env(key: &str) -> Option<String> {
|
||||
env::var(key).ok().filter(|s| !s.is_empty())
|
||||
}
|
||||
|
||||
/// The hive's canonical DNS domain when set, otherwise None. Single-hive
|
||||
/// deployments where `HYPERHIVE_HIVE_DOMAIN` is unset return None — callers
|
||||
/// then degrade gracefully to the short label.
|
||||
#[must_use]
|
||||
pub fn hive_domain() -> Option<String> {
|
||||
env::var("HYPERHIVE_HIVE_DOMAIN")
|
||||
.ok()
|
||||
.filter(|s| !s.is_empty())
|
||||
non_empty_env("HYPERHIVE_HIVE_DOMAIN")
|
||||
}
|
||||
|
||||
/// Human display name of this hive (e.g. `pr1ma`). Distinct from
|
||||
|
|
@ -32,9 +36,7 @@ pub fn hive_domain() -> Option<String> {
|
|||
/// at their discretion.
|
||||
#[must_use]
|
||||
pub fn hive_name() -> Option<String> {
|
||||
env::var("HYPERHIVE_HIVE_NAME")
|
||||
.ok()
|
||||
.filter(|s| !s.is_empty())
|
||||
non_empty_env("HYPERHIVE_HIVE_NAME")
|
||||
}
|
||||
|
||||
/// Human display name of the wider swarm this hive belongs to (e.g.
|
||||
|
|
@ -43,9 +45,7 @@ pub fn hive_name() -> Option<String> {
|
|||
/// `services.hyperhive.swarmName` option is unset.
|
||||
#[must_use]
|
||||
pub fn swarm_name() -> Option<String> {
|
||||
env::var("HYPERHIVE_SWARM_NAME")
|
||||
.ok()
|
||||
.filter(|s| !s.is_empty())
|
||||
non_empty_env("HYPERHIVE_SWARM_NAME")
|
||||
}
|
||||
|
||||
/// One peer hive in the same swarm. Parsed from `HYPERHIVE_PEERS`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue