Functions
_parse_bengal_key
1
list[str] | None
▼
Parse env key into config path.
- BENGAL_PARAMS_FOO_BAR → ['params', 'foo', 'b…
_parse_bengal_key
1
list[str] | None
▼
def _parse_bengal_key(env_key: str) -> list[str] | None
Parse env key into config path.
- BENGAL_PARAMS_FOO_BAR → ['params', 'foo', 'bar'] (underscore = nesting)
- BENGALxPARAMSxREPO_URL → ['params', 'repo_url'] (x = delimiter for keys with underscores)
Parameters
| Name | Type | Description |
|---|---|---|
env_key |
str |
Returns
list[str] | None
_set_nested
3
None
▼
Set config[path[0]][path[1]]...[path[-1]] = value, creating dicts as needed.
_set_nested
3
None
▼
def _set_nested(config: dict[str, Any], path: list[str], value: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
config |
dict[str, Any] |
|
path |
list[str] |
|
value |
str |
apply_bengal_overrides
1
dict[str, Any]
▼
Apply BENGAL_* environment variables as config overrides.
Iterates os.environ …
apply_bengal_overrides
1
dict[str, Any]
▼
def apply_bengal_overrides(config: dict[str, Any]) -> dict[str, Any]
Apply BENGAL_* environment variables as config overrides.
Iterates os.environ for keys starting with BENGAL_, parses the remainder into a config path, and sets the value. Empty values are ignored.
Parameters
| Name | Type | Description |
|---|---|---|
config |
dict[str, Any] |
Configuration dictionary (mutated in place). |
Returns
dict[str, Any]