refactor(#2285): repoint all hive-c0re host-path consumers to paths.rs
This commit is contained in:
parent
4162f557c9
commit
187c364feb
16 changed files with 95 additions and 125 deletions
|
|
@ -421,10 +421,11 @@ enum MatrixCmd {
|
|||
},
|
||||
}
|
||||
|
||||
/// Default htpasswd file path — the host-side location of the gateway's
|
||||
/// credential store, pre-created by a tmpfiles rule when
|
||||
/// `services.hyperhive.gateway.auth.enable = true`.
|
||||
const DEFAULT_HTPASSWD_FILE: &str = "/var/lib/hyperhive/gateway/gateway.htpasswd";
|
||||
// Default htpasswd file path — the host-side location of the gateway's
|
||||
// credential store, pre-created by a tmpfiles rule when
|
||||
// `services.hyperhive.gateway.auth.enable = true`. Literal lives in
|
||||
// `hive_c0re::paths`.
|
||||
use hive_c0re::paths::GATEWAY_HTPASSWD as DEFAULT_HTPASSWD_FILE;
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum GatewayCmd {
|
||||
|
|
@ -530,10 +531,10 @@ enum QuotaCmd {
|
|||
},
|
||||
}
|
||||
|
||||
/// Default host admin socket path. Must match `hive-c0re`'s default in
|
||||
/// `main.rs` (`/run/hyperhive/host.sock`) — the daemon binds there and
|
||||
/// `hivectl agents` connects to it.
|
||||
const DEFAULT_HOST_SOCKET: &str = "/run/hyperhive/host.sock";
|
||||
// Default host admin socket path. Shared with `hive-c0re`'s `main.rs`
|
||||
// default via `hive_c0re::paths::HOST_SOCKET` — the daemon binds there
|
||||
// and `hivectl agents` connects to it.
|
||||
use hive_c0re::paths::HOST_SOCKET as DEFAULT_HOST_SOCKET;
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum AgentsCmd {
|
||||
|
|
@ -689,10 +690,12 @@ async fn main() -> Result<()> {
|
|||
/// core (headless / SSH hosts where no browser opener exists); the open
|
||||
/// is convenience on top, so a missing/failed `xdg-open` is not an error.
|
||||
async fn open_url(socket: &Path, target: OpenTarget) -> Result<()> {
|
||||
let urls = query_hive_urls(socket).await.context(
|
||||
"could not reach the hive-c0re daemon for URLs — is hive-c0re running? \
|
||||
(the socket is at /run/hyperhive/host.sock)",
|
||||
)?;
|
||||
let urls = query_hive_urls(socket).await.with_context(|| {
|
||||
format!(
|
||||
"could not reach the hive-c0re daemon for URLs — is hive-c0re running? \
|
||||
(the socket is at {DEFAULT_HOST_SOCKET})"
|
||||
)
|
||||
})?;
|
||||
let (url, hint) = match target {
|
||||
OpenTarget::Home => (
|
||||
urls.home,
|
||||
|
|
@ -1067,7 +1070,10 @@ fn agent_exists(name: &str) -> Result<bool> {
|
|||
/// container.
|
||||
fn choom(name: &str, resume_session: Option<&str>) -> Result<()> {
|
||||
if !agent_exists(name)? {
|
||||
bail!("no such agent: '{name}' (no state dir under /var/lib/hyperhive/agents/)");
|
||||
bail!(
|
||||
"no such agent: '{name}' (no state dir under {}/)",
|
||||
hive_c0re::paths::AGENTS_ROOT
|
||||
);
|
||||
}
|
||||
let container = hive_c0re::lifecycle::container_name(name);
|
||||
// Enter as the agent's unix user (== agent name) so claude reads the
|
||||
|
|
|
|||
Loading…
Reference in a new issue