Skip to content

Commit

Permalink
Moved aws variables to top level
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Knight <[email protected]>
  • Loading branch information
eddie-knight committed Oct 29, 2023
1 parent dab9fc2 commit 77b8fd3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions example-config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
loglevel: Debug
WriteDirectory: test_output
AWS:
access_key: access
secret_key: supersecret
session_key: ""
region: us-east-1
raids:
rds:
creds:
aws_access_key: access
aws_secret_key: supersecret
aws_session_key: ""
aws_region: us-east-1
config:
instance_identifier: unique-id-name
database: test
Expand Down
18 changes: 9 additions & 9 deletions strikes/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func getHostRDSRegion() (string, error) {
}

func getAWSConfig() (cfg aws.Config, err error) {
if viper.IsSet("raids.rds.creds") &&
viper.IsSet("raids.rds.creds.aws_access_key") &&
viper.IsSet("raids.rds.creds.aws_secret_key") &&
viper.IsSet("raids.rds.creds.aws_region") {

access_key := viper.GetString("raids.rds.creds.aws_access_key")
secret_key := viper.GetString("raids.rds.creds.aws_secret_key")
session_key := viper.GetString("raids.rds.creds.aws_session_key")
region := viper.GetString("raids.rds.creds.aws_region")
if viper.IsSet("aws") &&
viper.IsSet("aws.access_key") &&
viper.IsSet("aws.secret_key") &&
viper.IsSet("aws.region") {

access_key := viper.GetString("aws.access_key")
secret_key := viper.GetString("aws.secret_key")
session_key := viper.GetString("aws.session_key")
region := viper.GetString("aws.region")

creds := credentials.NewStaticCredentialsProvider(access_key, secret_key, session_key)
cfg, err = config.LoadDefaultConfig(context.TODO(), config.WithCredentialsProvider(creds), config.WithRegion(region))
Expand Down

0 comments on commit 77b8fd3

Please sign in to comment.