HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.79k stars 192 forks source link

Add dynamic attribute access #133

Closed DrumRobot closed 2 years ago

DrumRobot commented 2 years ago

Add dynamic attribute access support to autoconfig in two ways:

@pytest.mark.parametrize('path', [['env', 'project']], indirect=True)
def test_autoconfig_attr(config):
    assert 'ENV' == config.KEY # via __getattr__
    assert 'ENV' == config['KEY'] # via __getitem__