feat: group host-side /var/lib/hyperhive state into db/ forge/ matrix/ run/ subdirs with startup migration
This commit is contained in:
parent
cfafc9d93d
commit
14c7b0d406
15 changed files with 261 additions and 51 deletions
|
|
@ -55,7 +55,7 @@ pub const HIVE_SPACE_NAME: &str = "hive";
|
|||
/// purgeable path — not deleted by `destroy --purge` on any agent.
|
||||
#[must_use]
|
||||
pub fn admin_token_path() -> PathBuf {
|
||||
PathBuf::from("/var/lib/hyperhive/matrix-admin-token")
|
||||
crate::paths::matrix_admin_token()
|
||||
}
|
||||
|
||||
/// Token file inside the agent's bind-mounted state dir (visible as
|
||||
|
|
@ -68,7 +68,7 @@ fn token_path(name: &str) -> PathBuf {
|
|||
/// purgeable `agent_state_root` tree so it survives `destroy --purge`
|
||||
/// and allows re-login recovery when the same agent name is re-spawned.
|
||||
///
|
||||
/// Path: `/var/lib/hyperhive/matrix-creds/<name>-password`
|
||||
/// Path: `/var/lib/hyperhive/matrix/creds/<name>-password`
|
||||
///
|
||||
/// The token file lives inside the agent's bind-mounted state dir (under
|
||||
/// `agent_notes_dir`) so the agent container can read it; the password
|
||||
|
|
@ -76,7 +76,7 @@ fn token_path(name: &str) -> PathBuf {
|
|||
/// the access token exclusively) and belongs with other hive-c0re
|
||||
/// credential state, not inside the purgeable per-agent tree.
|
||||
fn password_path(name: &str) -> PathBuf {
|
||||
PathBuf::from("/var/lib/hyperhive/matrix-creds").join(format!("{name}-password"))
|
||||
crate::paths::matrix_creds_dir().join(format!("{name}-password"))
|
||||
}
|
||||
|
||||
/// Legacy password path (inside the old purgeable `agent_notes_dir`).
|
||||
|
|
@ -92,7 +92,7 @@ fn legacy_password_path(name: &str) -> PathBuf {
|
|||
/// Outside every purgeable path — not deleted by `destroy --purge`.
|
||||
#[must_use]
|
||||
pub fn hive_space_room_id_path() -> PathBuf {
|
||||
PathBuf::from("/var/lib/hyperhive/matrix-space-room-id")
|
||||
crate::paths::matrix_space_room_id()
|
||||
}
|
||||
|
||||
/// Probe whether `hive-matrix` exists as a nixos-container. Cheap —
|
||||
|
|
@ -661,7 +661,7 @@ pub async fn ensure_user_for(
|
|||
// Password file missing — attempt auto-recovery via admin API.
|
||||
// This covers the case where agent state dirs were wiped but the
|
||||
// homeserver still has the accounts. Requires the hive admin
|
||||
// token at /var/lib/hyperhive/matrix-admin-token.
|
||||
// token at /var/lib/hyperhive/matrix/admin-token.
|
||||
tracing::info!(
|
||||
%name,
|
||||
"matrix: stored password missing, attempting admin-API auto-recovery"
|
||||
|
|
|
|||
Loading…
Reference in a new issue