failclose
azure_bootstrap.failclose
¶
Fail-closed-for-auth / fail-open-for-features env helpers.
ConfigurationError is re-exported from :mod:azure_bootstrap.models.exceptions
so callers see a single canonical class regardless of which import path
they use. v1 callers of ConfigurationError keep working unchanged.
Use:
- :func:require_env for tenant_id, connection strings, secrets — anything
whose absence MUST stop the pipeline.
- :func:optional_env for endpoint URLs that have sensible defaults or
feature flags with documented fallback semantics.
- :func:fail_open_env for "feature disabled when None" semantics — comment
every call site with the threat consequence of the open default.
Classes:
| Name | Description |
|---|---|
ConfigurationError |
Exception raised when configuration loading or access fails. |
Functions:
| Name | Description |
|---|---|
require_env |
Return |
optional_env |
Return |
fail_open_env |
Return the env value when truthy, else None — for "feature disabled" semantics. |
ConfigurationError
¶
Bases: RepositoryError
Exception raised when configuration loading or access fails.
This exception is raised when: - Azure App Configuration connection fails - Configuration values are missing or invalid - Configuration refresh operations fail - Configuration loading encounters critical errors
require_env
¶
Return os.environ[name] when truthy; raise ConfigurationError otherwise.
Source code in azure_bootstrap/failclose/__init__.py
optional_env
¶
fail_open_env
¶
Return the env value when truthy, else None — for "feature disabled" semantics.