fix(#1897): treat empty HYPERHIVE_HIVE_DOMAIN as unset in HiveDomain
Per argus review: std::env::var(..).ok() yields Some("") for an empty
env value, so require_hive_domain would 'succeed' with an empty domain
and emit invalid nix (swarm.peers."" = …). Filter empty so it resolves
to None → the CLI's clear 'domain unset' error fires instead.
This commit is contained in:
parent
8ea19b3b12
commit
dc3d6bc753
1 changed files with 7 additions and 3 deletions
|
|
@ -117,9 +117,13 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
|
|||
// The hive domain is injected into c0re's service env by
|
||||
// hive-c0re.nix (`HYPERHIVE_HIVE_DOMAIN`); surface it so the
|
||||
// operator CLI can fill in this hive's own identity.
|
||||
HostRequest::HiveDomain => {
|
||||
HostResponse::hive_domain(std::env::var("HYPERHIVE_HIVE_DOMAIN").ok())
|
||||
}
|
||||
HostRequest::HiveDomain => HostResponse::hive_domain(
|
||||
// Treat an empty env value as unset — otherwise the CLI
|
||||
// would emit `swarm.peers."" = …`, invalid nix.
|
||||
std::env::var("HYPERHIVE_HIVE_DOMAIN")
|
||||
.ok()
|
||||
.filter(|d| !d.is_empty()),
|
||||
),
|
||||
HostRequest::Pending => HostResponse::pending(coord.approvals.pending()?),
|
||||
HostRequest::Approve { id } => {
|
||||
actions::approve(coord.clone(), *id).await?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue