feat(#2302): thread &Ident through agent path builders
This commit is contained in:
parent
1286029947
commit
bf644cc126
23 changed files with 168 additions and 85 deletions
|
|
@ -31,9 +31,13 @@ pub const HOST_SOCKET: &str = "/run/hyperhive/host.sock";
|
|||
pub const AGENTS_ROOT: &str = "/var/lib/hyperhive/agents";
|
||||
|
||||
/// `agents/<name>` — one agent's persistent state root.
|
||||
///
|
||||
/// Takes a validated [`Ident`] (not a raw `&str`) so a per-agent state path
|
||||
/// can never be built from an unvalidated name — the `../` traversal guard is
|
||||
/// the type, enforced at the one place every agent path is rooted.
|
||||
#[must_use]
|
||||
pub fn agent_state_dir(name: &str) -> PathBuf {
|
||||
PathBuf::from(AGENTS_ROOT).join(name)
|
||||
pub fn agent_state_dir(name: &Ident) -> PathBuf {
|
||||
PathBuf::from(AGENTS_ROOT).join(name.as_str())
|
||||
}
|
||||
|
||||
/// `gateway/gateway.htpasswd` — nginx basic-auth credential store for the
|
||||
|
|
|
|||
Loading…
Reference in a new issue