feat(#1897): auto-fill the hive domain in peer-config (drop required --domain)

Per operator review: hivectl shouldn't make the operator retype this
hive's own domain. Add a HostRequest::HiveDomain admin-socket query
(c0re answers from HYPERHIVE_HIVE_DOMAIN, already in its service env) and
a domain field on HostResponse.

hivectl peer-config now resolves the domain as: --domain override (kept
for offline/scripted use), else the daemon query; errors with a clear
hint when neither resolves. wg init resolves it best-effort too, so it
prints the hand-over peer-config block without --domain (skipped, not
failed, when the daemon is unreachable).

Regenerated docs/tools/hivectl-cli.md.
This commit is contained in:
atlas 2026-06-22 18:49:09 +02:00 committed by mara
commit 72d9422a7a
4 changed files with 89 additions and 19 deletions

View file

@ -114,6 +114,12 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
}
HostRequest::Rebuild { name } => handle_rebuild(&coord, name).await?,
HostRequest::List => HostResponse::list(lifecycle::list().await?),
// 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::Pending => HostResponse::pending(coord.approvals.pending()?),
HostRequest::Approve { id } => {
actions::approve(coord.clone(), *id).await?;
@ -210,6 +216,7 @@ async fn handle_restart_all() -> Result<HostResponse> {
error: Some(errors.join("; ")),
agents: Some(ok_agents),
approvals: None,
domain: None,
})
}
}
@ -368,6 +375,7 @@ fn finish_lifecycle(ok_items: Vec<String>, errors: &[String]) -> HostResponse {
error: Some(errors.join("; ")),
agents: Some(ok_items),
approvals: None,
domain: None,
}
}
}