pub struct Config { /* private fields */ }Expand description
Fully resolved provider configuration.
Values are resolved once at construction through the documented
precedence chain; the account ID is validated for shape and the token is
held in a SecretString.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self, CloudflareError>
pub fn from_env() -> Result<Self, CloudflareError>
Resolve configuration strictly: constructor/env/config file, or a
typed CloudflareError::MissingEnv error naming the exact
environment variable that is missing.
Sourcepub fn from_env_lenient() -> Option<Self>
pub fn from_env_lenient() -> Option<Self>
Resolve configuration leniently (profile bootstrap): None whenever
the account ID or token cannot be resolved and validated.
Sourcepub fn account_id(&self) -> &str
pub fn account_id(&self) -> &str
The validated account ID (non-secret operational metadata).
Sourcepub fn api_token(&self) -> &SecretString
pub fn api_token(&self) -> &SecretString
The API token - redacted everywhere except as_ref()/into().
Sourcepub fn base_url(&self) -> Result<String, CloudflareError>
pub fn base_url(&self) -> Result<String, CloudflareError>
The Workers AI inference base URL: the explicit override when set,
otherwise derived as
https://api.cloudflare.com/client/v4/accounts/<id>/ai/v1.
Sourcepub fn cache_dir(&self) -> PathBuf
pub fn cache_dir(&self) -> PathBuf
The account-scoped cache directory.
Explicit override wins; the default is
$HERMES_HOME/cache/auth-cloudflare/<slug>/ where <slug> is the
stable 16-hex account hash and HERMES_HOME falls back to ~/.hermes.
The token never enters the cache path.
Sourcepub fn config_path(&self) -> PathBuf
pub fn config_path(&self) -> PathBuf
The user config file path: AUTH_CLOUDFLARE_CONFIG override or
$HERMES_HOME/auth-cloudflare/config.json.