python-dependency-injector/examples/providers/configuration/configuration_env_interpolation_os_default.py
2021-09-30 15:32:21 -04:00

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"