Skip to content

Commit

Permalink
Configurable SSO directories
Browse files Browse the repository at this point in the history
Allows configuring SSO directories explicitly in addition to more sane defaults (discovering them from AWS SDK credentials/config file locations)
  • Loading branch information
nazarewk authored Apr 21, 2022
1 parent 1af1ee0 commit 9da1978
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/aws_sso_lib/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@

SSO_TOKEN_DIR = os.path.expanduser(
os.path.join("~", ".aws", "sso", "cache")

AWS_CREDENTIALS_DIR = (
os.path.dirname(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", "")) or
os.path.dirname(os.environ.get("AWS_CONFIG_FILE", "")) or
os.path.expanduser(os.path.join("~", ".aws"))
)

SSO_TOKEN_DIR = os.environ.get("AWS_SSO_UTIL_SSO_TOKEN_DIR") or os.path.join(
AWS_CREDENTIALS_DIR,
"sso",
"cache",
)

CREDENTIALS_CACHE_DIR = os.path.expanduser(
os.path.join("~", ".aws", "cli", "cache")
CREDENTIALS_CACHE_DIR = os.environ.get("AWS_SSO_UTIL_CREDENTIALS_CACHE_DIR") or os.path.join(
AWS_CREDENTIALS_DIR,
"cli",
"cache",
)

LOGGER = logging.getLogger(__name__)
Expand Down

0 comments on commit 9da1978

Please sign in to comment.