Skip to content

Commit

Permalink
respect env var override over config
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Silverman committed May 15, 2024
1 parent 060e29e commit c9fdadb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/awsClients/AwsConfig/AwsConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package AwsConfig

import (
"context"
"os"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/middleware"
Expand All @@ -20,7 +21,10 @@ func BuildConfig(args utils.Args) aws.Config {

scp, err := config.LoadSharedConfigProfile(context.TODO(), args.Profile)
utils.Panic(err)
if scp.Region == "" {
env_region, env_present := os.LookupEnv("AWS_REGION")
if env_present {
scp.Region = env_region
} else if scp.Region == "" {
scp.Region = "us-east-1"
}

Expand Down

0 comments on commit c9fdadb

Please sign in to comment.