Skip to main content

set_admin_token

Function set_admin_token 

Source
pub fn set_admin_token(
    auth_path: &Path,
    token: &str,
    owner: &str,
) -> Result<SetTokenOutcome, String>
Expand description

Sets (or updates) an admin/API token in the JSON token file at auth_path (config.json / CORTEX_AUTH_FILE) — the single source of truth for rerun_tokensmerging into the existing file so other tokens are preserved. The library logic behind cortex set-admin-token.

If the file is missing it is created with just this token (an empty rerun_tokens map otherwise). There is no cortex.toml [auth] layering anymore, so a written token takes effect immediately (the frontend re-reads this file on every gated request). Mapping the token to a per-person owner is what gives the audit log its actor (docs/archive/AAA_DESIGN.md).