Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded paths for aws config and credentials files #16

Open
browseman opened this issue Nov 12, 2020 · 2 comments
Open

Hardcoded paths for aws config and credentials files #16

browseman opened this issue Nov 12, 2020 · 2 comments

Comments

@browseman
Copy link

browseman commented Nov 12, 2020

aws-saml does not follow the environment variables that awscli is supporting (link):

  • AWS_CONFIG_FILE
  • AWS_SHARED_CREDENTIALS_FILE

a simple patch will fix this:

diff --git a/awscli_saml/assume_role.py b/awscli_saml/assume_role.py
index 3d520a8..cb3a47b 100644
--- a/awscli_saml/assume_role.py
+++ b/awscli_saml/assume_role.py
@@ -19,8 +19,8 @@ def run(profile=None, region=None, session_duration=None, idp_arn=None, role_arn
         profile_name if profile_name == "default" else "profile {}".format(profile_name)
     )
 
-    config_path = os.path.expanduser("~/.aws/config")
-    cred_path = os.path.expanduser("~/.aws/credentials")
+    config_path = os.environ.get("AWS_CONFIG_FILE") or os.path.expanduser("~/.aws/config")
+    cred_path = os.environ.get("AWS_SHARED_CREDENTIALS_FILE") or os.path.expanduser("~/.aws/credentials")
 
     config = configparser.RawConfigParser()
     config.read(config_path)
@pauldraper
Copy link
Contributor

Feel free to submit PR

@browseman
Copy link
Author

browseman commented Nov 18, 2020

PR submitted/approve/merged. Can we get a new version release containing those changes, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants