mirror of
https://github.com/nikdoof/dotfiles.git
synced 2025-12-13 01:32:30 +00:00
Compare commits
3 Commits
b66a25ef26
...
4115692e51
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4115692e51 | ||
|
|
d27de08a5c | ||
|
|
7b493cbfde |
@@ -20,9 +20,12 @@ brew "poetry"
|
||||
brew "sass/sass/sass"
|
||||
brew "smartmontools"
|
||||
brew "hashicorp/tap/terraform"
|
||||
brew "terraform-local"
|
||||
brew "tz"
|
||||
brew "uv"
|
||||
brew "yazi"
|
||||
brew "jq"
|
||||
brew "fzf"
|
||||
|
||||
cask "appcleaner"
|
||||
cask "balenaetcher"
|
||||
|
||||
@@ -71,10 +71,36 @@ function awslogout() {
|
||||
unset AWS_ACCESS_KEY_ID
|
||||
unset AWS_SECRET_ACCESS_KEY
|
||||
unset AWS_SESSION_TOKEN
|
||||
unset AWS_CREDENTIAL_EXPIRATION
|
||||
export AWS_PROFILE_DISPLAY=""
|
||||
echo "AWS profile and credentials cleared."
|
||||
}
|
||||
|
||||
function _aws_creds_expiration_check() {
|
||||
if [[ -n "$AWS_CREDENTIAL_EXPIRATION" ]]; then
|
||||
local expiration_epoch
|
||||
local current_epoch
|
||||
|
||||
# Convert expiration time to epoch (handles ISO 8601 format)
|
||||
if command -v gdate &> /dev/null; then
|
||||
# macOS with GNU coreutils installed
|
||||
expiration_epoch=$(gdate -d "$AWS_CREDENTIAL_EXPIRATION" +%s 2>/dev/null)
|
||||
current_epoch=$(gdate +%s)
|
||||
else
|
||||
# macOS with BSD date
|
||||
expiration_epoch=$(date -j -f "%Y-%m-%dT%H:%M:%S%z" "$AWS_CREDENTIAL_EXPIRATION" +%s 2>/dev/null)
|
||||
current_epoch=$(date +%s)
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 && -n "$expiration_epoch" ]]; then
|
||||
if [[ $current_epoch -ge $expiration_epoch ]]; then
|
||||
echo "AWS credentials have expired. Logging out..."
|
||||
awslogout
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# easy access to SSH
|
||||
function awsssh() {
|
||||
local profile=""
|
||||
|
||||
Reference in New Issue
Block a user