libb.configure_environment
- configure_environment(module, **config_overrides)[source]
Configure environment settings at runtime.
Dynamically sets configuration values on Setting objects in the provided module. Keys should follow the pattern
setting_attributeorsetting_nested_attribute.- Parameters:
module – The module containing Setting objects to configure.
config_overrides (
Any) – Configuration values to set with keys as dotted paths.
- Return type:
Example:
>>> from libb import create_mock_module >>> Setting.unlock() >>> db = Setting() >>> db.host = 'localhost' >>> Setting.lock() >>> create_mock_module('my_config', {'db': db}) >>> import my_config >>> configure_environment(my_config, db_host='remotehost') >>> my_config.db.host 'remotehost'