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

replace AWS_SESSION_EXPIRATION for aws-vault #341

Closed
wants to merge 1 commit into from

Conversation

ismailyenigul
Copy link

aws-vault 7.X removed AWS_SESSION_EXPIRATION env and replaced with AWS_CREDENTIAL_EXPIRATION
To make this theme works for aws-vault 7.X, we must replace this env.

see: 99designs/aws-vault#1143

aws-vault 7.X removed  AWS_SESSION_EXPIRATION env and replaced with AWS_CREDENTIAL_EXPIRATION
to make this theme work for aws-vault 7.X, we must replace this env.

see: 99designs/aws-vault#1143
@bobthecow
Copy link
Member

do older versions of aws-vault support AWS_CREDENTIAL_EXPIRATION as well, or does this change break the AWS prompt integration unless everyone has updated?

@ismailyenigul
Copy link
Author

No it is not supported in older versions. It is breaking changes in v7.0

@bobthecow
Copy link
Member

Gotcha. If that's the case it probably makes the most sense if bobthefish falls back to the old variable if the new one isn't available.

@ismailyenigul
Copy link
Author

let me try to add conditions to support AWS_CREDENTIAL_EXPIRATION as well

@ismailyenigul
Copy link
Author

what do you think about the following changes

[ -n "$AWS_VAULT" -a -n "$AWS_CREDENTIAL_EXPIRATION" -o "$AWS_SESSION_EXPIRATION" ]
    or return

    set -l profile $AWS_VAULT
    set -l now (gdate --utc +%s)

    if [ -n  "$AWS_CREDENTIAL_EXPIRATION" ]
        set  aws_vault_expiry (gdate -d "$AWS_CREDENTIAL_EXPIRATION" +%s)
    else
        set  aws_vault_expiry (gdate -d "$AWS_SESSION_EXPIRATION" +%s)
    end
    
    #set -l expiry (gdate -d "$AWS_CREDENTIAL_EXPIRATION" +%s)
    set -l diff_mins (math "floor(( $aws_vault_expiry - $now ) / 60)")
   

@bobthecow
Copy link
Member

@ismailyenigul thanks for this! i merged the fix in #351 because I missed that this one came first 😬

@bobthecow bobthecow closed this Mar 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants