diff --git a/decouple.py b/decouple.py index 9873fc9..8331330 100644 --- a/decouple.py +++ b/decouple.py @@ -152,6 +152,10 @@ def __init__(self, source, encoding=DEFAULT_ENCODING): line = line.strip() if not line or line.startswith('#') or '=' not in line: continue + if line.startswith('export ') or line.startswith('export\t'): + line = line[7:].lstrip() + if not line or '=' not in line: + continue k, v = line.split('=', 1) k = k.strip() v = v.strip() diff --git a/tests/test_env.py b/tests/test_env.py index a91c95c..1b4ffe5 100644 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -49,6 +49,8 @@ KeyHasTwoDoubleQuote='"Y"' KeyHasMixedQuotesAsData1="Y' KeyHasMixedQuotesAsData2='Y" +export ExportedKey=fromexport +export ExportedTab=tabs ''' @pytest.fixture(scope='module') @@ -140,3 +142,8 @@ def test_env_with_quote(config): def test_env_repo_keyerror(config): with pytest.raises(KeyError): config.repository['UndefinedKey'] + + +def test_env_export_prefix(config): + assert 'fromexport' == config('ExportedKey') + assert 'tabs' == config('ExportedTab')