Skip to main content

get_api_key

Function get_api_key 

Source
pub fn get_api_key(provider: &str, _sources: &ApiKeySources) -> Result<String>
Expand description

Get API key for a specific provider.

Resolution order:

  1. Environment variable inferred from the provider name (e.g. POOLSIDE_API_KEY)
  2. Provider-specific fallbacks (OAuth tokens, alternate env vars, etc.)
  3. OS keyring / encrypted file storage

Adding a new built-in provider only requires:

  • A Provider variant with default_api_key_env() returning the env var name
  • (Optional) a match arm here only if the provider needs special fallback logic