From 9727d5a3ed0f35cd525ad90bf5cf12f60a381c7c Mon Sep 17 00:00:00 2001 From: AlexClineBB Date: Wed, 31 May 2017 14:54:39 -0400 Subject: [PATCH] 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. --- prowler | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/prowler b/prowler index 0babb90b..36ce43f0 100755 --- a/prowler +++ b/prowler @@ -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