refactor(#2302): type socket wire fields as ident, validated by serde on deserialize
This commit is contained in:
parent
bf644cc126
commit
84b750fba5
33 changed files with 333 additions and 263 deletions
|
|
@ -65,7 +65,7 @@ pub fn admin_token_path() -> PathBuf {
|
|||
|
||||
/// Token file inside the agent's bind-mounted state dir (visible as
|
||||
/// `/state/matrix-token` from inside the container).
|
||||
fn token_path(name: &hive_host_sock::Ident) -> PathBuf {
|
||||
fn token_path(name: &hive_types::Ident) -> PathBuf {
|
||||
Coordinator::agent_notes_dir(name).join("matrix-token")
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ fn password_path(name: &str) -> PathBuf {
|
|||
/// move credentials from old deployments to the new location. Safe to
|
||||
/// call after `destroy --purge` — the path will simply not exist and
|
||||
/// the migration is a no-op.
|
||||
fn legacy_password_path(name: &hive_host_sock::Ident) -> PathBuf {
|
||||
fn legacy_password_path(name: &hive_types::Ident) -> PathBuf {
|
||||
Coordinator::agent_notes_dir(name).join("matrix-password")
|
||||
}
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ pub async fn ensure_user_for(
|
|||
register_token: &str,
|
||||
) -> Result<()> {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let agent = hive_host_sock::Ident::parse(name)
|
||||
let agent = hive_types::Ident::parse(name)
|
||||
.map_err(|e| anyhow::anyhow!("invalid agent name {name:?}: {e}"))?;
|
||||
let path = token_path(&agent);
|
||||
if path.exists()
|
||||
|
|
|
|||
Loading…
Reference in a new issue