resolve_container_config()
Description
Section titled “Description”Resolve a logical container key to a name + Azure config.
The config is resolved from a TOML file plus the environment.
Looks up the container definition under [containers] in the TOML
file and maps it to an Azure auth configuration for the selected
env. Auth can be referenced in two ways:
- Tag indirection (shared auth across containers):
azure_auth.<env>is a string referencing a[azure_auth.<tag>]section. - Inline nested auth (per-container):
azure_auth.<env>is a nested table defining the auth fields directly under[containers.<key>.azure_auth.<env>].
tenant_id_env, client_id_env, and device_code_client_id_env
name the environment variables that hold those identity values. An
environment variable that is set at runtime wins; otherwise the
direct tenant_id, client_id, or device_code_client_id value
from the TOML is used. This keeps CI-provided or pre-exported
values authoritative over the local direnv fallback.
client_secret_env is the name of the environment variable that
holds the client secret; it is resolved from os.environ at load
time so no secret is stored in the TOML. An unset variable yields
None rather than an error: only client-credentials auth needs the
secret, and the storage handler reports the missing value when that
method is actually used. This keeps device-code login working when
only device_code_client_id is available. SAS tokens are not part
of this file: the storage handler resolves them from the
environment via sas_token_env_var() when connecting.
If the resolved auth spec defines no storage_account, the full
configuration is read from environment variables via
AzureStorageConfig.from_env() instead.
config.resolve_container_config(container_key: str, env: str, toml_file: Union[str, Path] = DEFAULT_CONTAINER_CONFIG_FILE) -> Tuple[Optional[str], Optional[AzureStorageConfig]]Arguments
Section titled “Arguments”| Argument | Type | Description |
|---|---|---|
container_key |
str | Logical container key under [containers]. |
env |
str | Environment name (e.g. ‘staging’, ‘prod’). ‘local’ short-circuits to the local filesystem. |
toml_file |
Union[str, Path] | Path to the TOML config file. Defaults to container-config.toml in the current working directory. |
Returns
Section titled “Returns”- Tuple[Optional[str], Optional[AzureStorageConfig]]: The resolved
concrete container name and an
AzureStorageConfigsuitable forStorageHandler. Both areNonefor the local filesystem (env='local').
Raises
Section titled “Raises”- ****: If
toml_filedoes not exist. - ****: If the container key is unknown, the TOML is
missing the auth or name for the selected env,
nameorazure_authis not a table keyed by environment, or the referenced auth tag does not exist.
