refactor(#2285): repoint knowledge + forge core-token to paths.rs consts
This commit is contained in:
parent
1cefaf2c16
commit
4162f557c9
3 changed files with 15 additions and 15 deletions
|
|
@ -15,10 +15,10 @@ use reqwest::StatusCode;
|
||||||
use super::{CONFIG_ORG, api, forge_admin, is_present};
|
use super::{CONFIG_ORG, api, forge_admin, is_present};
|
||||||
|
|
||||||
const TOKEN_NAME_PREFIX: &str = "hyperhive";
|
const TOKEN_NAME_PREFIX: &str = "hyperhive";
|
||||||
/// Where the host-side `core` admin token lives. Used by hive-c0re
|
// Where the host-side `core` admin token lives. Used by hive-c0re itself
|
||||||
/// itself to push the meta repo + drive admin API calls (org
|
// to push the meta repo + drive admin API calls. Root-only. Literal lives
|
||||||
/// creation, future webhook setup, etc.). Root-only.
|
// in `crate::paths`; aliased here under the long-standing name.
|
||||||
const CORE_TOKEN_PATH: &str = "/var/lib/hyperhive/forge-core-token";
|
use crate::paths::FORGE_CORE_TOKEN as CORE_TOKEN_PATH;
|
||||||
// Forge provisioning markers (`forge/core-avatar-set`,
|
// Forge provisioning markers (`forge/core-avatar-set`,
|
||||||
// `forge/agent-configs-avatar-set`, `forge/email-aligned-<name>`) live
|
// `forge/agent-configs-avatar-set`, `forge/email-aligned-<name>`) live
|
||||||
// in `crate::paths` — one-shot guards: the upload/align runs once, the
|
// in `crate::paths` — one-shot guards: the upload/align runs once, the
|
||||||
|
|
|
||||||
|
|
@ -209,12 +209,11 @@ pub fn shared_root() -> PathBuf {
|
||||||
state_root().join("shared")
|
state_root().join("shared")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `knowledge/` — local checkout of the `internal/knowledge` repo.
|
/// `knowledge/` — local checkout of the `internal/knowledge` repo. A
|
||||||
|
/// `&str` (used as a git `-C` arg / clone target throughout the knowledge
|
||||||
|
/// worker), so it stays a const rather than a `PathBuf` fn.
|
||||||
// nix: bind-mounted read-only into agent containers as `/knowledge` (harness-base.nix) — must match.
|
// nix: bind-mounted read-only into agent containers as `/knowledge` (harness-base.nix) — must match.
|
||||||
#[must_use]
|
pub const KNOWLEDGE_DIR: &str = "/var/lib/hyperhive/knowledge";
|
||||||
pub fn knowledge_dir() -> PathBuf {
|
|
||||||
state_root().join("knowledge")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `gateway/` — generated nginx include fragments for the gateway vhost.
|
/// `gateway/` — generated nginx include fragments for the gateway vhost.
|
||||||
// nix: bind-mounted into the gateway container (hive-gateway.nix) — must match.
|
// nix: bind-mounted into the gateway container (hive-gateway.nix) — must match.
|
||||||
|
|
@ -229,12 +228,11 @@ pub fn gateway_agents_conf() -> PathBuf {
|
||||||
gateway_dir().join("agents.conf")
|
gateway_dir().join("agents.conf")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `forge-core-token` — the hive-c0re forge account API token.
|
/// `forge-core-token` — the hive-c0re forge account API token. A `&str`
|
||||||
|
/// (used in `Path::new` + user-facing `format!` messages), so it stays a
|
||||||
|
/// const rather than a `PathBuf` fn.
|
||||||
// nix: bind-mounted into the forge container / read at provisioning (hive-forge.nix) — must match.
|
// nix: bind-mounted into the forge container / read at provisioning (hive-forge.nix) — must match.
|
||||||
#[must_use]
|
pub const FORGE_CORE_TOKEN: &str = "/var/lib/hyperhive/forge-core-token";
|
||||||
pub fn forge_core_token() -> PathBuf {
|
|
||||||
state_root().join("forge-core-token")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `matrix-register-token` — shared matrix registration token.
|
/// `matrix-register-token` — shared matrix registration token.
|
||||||
// nix: bind-mounted into the tuwunel/matrix container (hive-matrix.nix) — must match.
|
// nix: bind-mounted into the tuwunel/matrix container (hive-matrix.nix) — must match.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ pub const REPO: &str = "knowledge";
|
||||||
|
|
||||||
/// Host-side path for the local clone. Also referenced from
|
/// Host-side path for the local clone. Also referenced from
|
||||||
/// `lifecycle.rs` (bind-mount source) and the dashboard webhook handler.
|
/// `lifecycle.rs` (bind-mount source) and the dashboard webhook handler.
|
||||||
pub const LOCAL_DIR: &str = "/var/lib/hyperhive/knowledge";
|
/// The literal lives in [`crate::paths`]; re-exported here under the name
|
||||||
|
/// this module and its consumers have always used.
|
||||||
|
pub use crate::paths::KNOWLEDGE_DIR as LOCAL_DIR;
|
||||||
|
|
||||||
/// In-container mount point for the knowledge repo. Bind-mounted
|
/// In-container mount point for the knowledge repo. Bind-mounted
|
||||||
/// read-only from [`LOCAL_DIR`] into every agent container.
|
/// read-only from [`LOCAL_DIR`] into every agent container.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue