mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 18:13:56 +03:00
15 lines
563 B
Python
15 lines
563 B
Python
"""`Configuration` provider values loading example."""
|
|
|
|
from dependency_injector import providers
|
|
|
|
|
|
config = providers.Configuration()
|
|
|
|
config.from_yaml('examples/providers/configuration/config.yml')
|
|
config.from_yaml('examples/providers/configuration/config.local.yml')
|
|
|
|
assert config() == {'aws': {'access_key_id': 'LOCAL-KEY', 'secret_access_key': 'LOCAL-SECRET'}}
|
|
assert config.aws() == {'access_key_id': 'LOCAL-KEY', 'secret_access_key': 'LOCAL-SECRET'}
|
|
assert config.aws.access_key_id() == 'LOCAL-KEY'
|
|
assert config.aws.secret_access_key() == 'LOCAL-SECRET'
|