mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-01 05:53:59 +03:00
ef049daae5
* Make prototype with enterpolation before parsing * Add test for option.from_yaml() with missing env not required * Make some cosmetic changes to _resolve_config_env_markers() * Add test for option.from_ini() missing envs not required * Skip schema test cause it requires internet connection * Add tests for .from_yaml() for config and config option * Add tests for .from_ini() for config and config option * Add example for os.environ.setdefault() and envs interpolation * Add/update docs on environment variables interpolation * Update changelog
20 lines
448 B
Python
20 lines
448 B
Python
"""`Configuration` provider values loading example."""
|
|
|
|
import os
|
|
|
|
from dependency_injector import containers, providers
|
|
|
|
|
|
class Container(containers.DeclarativeContainer):
|
|
|
|
config = providers.Configuration()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
os.environ.setdefault('ENV_VAR', 'default value')
|
|
|
|
container = Container()
|
|
container.config.from_yaml('config-with-env-var.yml')
|
|
|
|
assert container.config.section.option() == 'default value'
|