1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-10-14 14:39:08 +00:00

[aws] Fix switch_aws_profile when dealing with AWS_DEFAULT_REGION

This commit is contained in:
2020-02-22 19:41:14 +01:00
parent cb0099ec7a
commit a73bb314cc
2 changed files with 9 additions and 3 deletions

View File

@@ -136,9 +136,15 @@ function ssh_aws_any {
function aws_switch_profile {
echo "Activating profile $1..."
export AWS_PROFILE=$1
local region
export AWS_PROFILE=$1
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
export AWS_DEFAULT_REGION=$(aws configure get region)
region=$(aws configure get region)
if [[ ! -z $region ]]; then
export AWS_DEFAULT_REGION=$region
else
unset AWS_DEFAULT_REGION
fi
fi
}