Add AWS_CONFIG_FILE to the environment variables
Turns out there is an additional environment variable AWS_CONFIG_FILE,
which gets evaluated for finding configuration files as well. This
commit adds support for it.
diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py
index 420333d..ed895d6 100644
--- a/pre_commit_hooks/detect_aws_credentials.py
+++ b/pre_commit_hooks/detect_aws_credentials.py
@@ -10,8 +10,8 @@
def get_aws_credential_files_from_env():
"""Extract credential file paths from environment variables."""
files = set()
- for env_var in {'AWS_CREDENTIAL_FILE', 'AWS_SHARED_CREDENTIALS_FILE',
- 'BOTO_CONFIG'}:
+ for env_var in {'AWS_CONFIG_FILE', 'AWS_CREDENTIAL_FILE',
+ 'AWS_SHARED_CREDENTIALS_FILE', 'BOTO_CONFIG'}:
try:
files.add(os.environ[env_var])
except KeyError:
diff --git a/tests/detect_aws_credentials_test.py b/tests/detect_aws_credentials_test.py
index 410a33f..a366f01 100644
--- a/tests/detect_aws_credentials_test.py
+++ b/tests/detect_aws_credentials_test.py
@@ -19,8 +19,10 @@
assert get_aws_credential_files_from_env() == {'/foo', '/bar'}
monkeypatch.setenv('BOTO_CONFIG', '/baz')
assert get_aws_credential_files_from_env() == {'/foo', '/bar', '/baz'}
+ monkeypatch.setenv('AWS_CONFIG_FILE', '/xxx')
+ assert get_aws_credential_files_from_env() == {'/foo', '/bar', '/baz', '/xxx'}
monkeypatch.setenv('AWS_DUMMY_KEY', 'foobar')
- assert get_aws_credential_files_from_env() == {'/foo', '/bar', '/baz'}
+ assert get_aws_credential_files_from_env() == {'/foo', '/bar', '/baz', '/xxx'}
def test_get_aws_secrets_from_env(monkeypatch):