New paste Repaste Download
def apply_config_env_overrides(config: dict[str, Any]) -> dict[str, Any]:
    # Don't edit in place
    ret = deepcopy(config)
    # fmt: off
    overrides_vars = {
        k.replace("CBP_CONFIG_", ""): v
        for k, v in os.environ.items()
        if k.startswith("CBP_CONFIG_")
    }
    # fmt: on
    for config_key, value in overrides_vars.items():
        attrs = config_key.split("__")
        attr_to_set = attrs.pop()
        obj_to_update = ret
        for attr in attrs:
            obj_to_update = obj_to_update.get(attr)
        obj_to_update[attr_to_set] = value
    return ret
Filename: None. Size: 624b. View raw, , hex, or download this file.

This paste expires on 2025-02-11 10:07:44.407294. Pasted through web.