mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-01 22:14:04 +03:00
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'
|