Skip to main content

resolve_token

Function resolve_token 

Source
pub fn resolve_token(env_name: &str) -> Result<Option<String>, String>
Expand description

Resolve a session token from env or a token file, for an arbitrary env var name. See module docs for the resolution order.

env_name is e.g. "ATI_SESSION_TOKEN" or "PARCHA_TOOLS_SESSION_TOKEN". The associated file path defaults to [default_token_file](env_name) but can be overridden by <env_name>_FILE.

Returns:

  • Ok(Some(token)) if a non-empty token was found
  • Ok(None) if no source supplied a token (env unset/empty, file missing or empty)
  • Err(msg) only if a configured file path exists but cannot be read (e.g., permission denied)