Set defaults for environment variables

This change sets the defaults for PROFILE and REGION before they're set by getopts,
allowing us to add support for more options without needing to update the default
setting code that happened after the options were parsed.
This commit is contained in:
AlexClineBB
2017-05-31 14:54:39 -04:00
parent 666a1c42cd
commit 9727d5a3ed

10
prowler
View File

@@ -45,8 +45,9 @@ RED=""
YELLOW=""
WHITE=""
DEFULT_AWS_PROFILE="default"
DEFAULT_AWS_REGION="us-east-1"
# Set the defaults for these getopts variables
PROFILE="default"
REGION="us-east-1"
# Command usage menu
usage(){
@@ -160,11 +161,6 @@ else
exit
fi
if [[ "$#" -le 2 ]]; then
PROFILE=$DEFULT_AWS_PROFILE
REGION=$DEFAULT_AWS_REGION
fi
if [[ ! -f ~/.aws/credentials ]]; then
echo -e "\n$RED ERROR!$NORMAL AWS credentials file not found (~/.aws/credentials). Run 'aws configure' first. \n"
return 1