Skip to content

Commit

Permalink
if region not set, default to us-east-1
Browse files Browse the repository at this point in the history
  • Loading branch information
soapiestwaffles committed May 12, 2024
1 parent 65d8e27 commit 8e1f225
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/aws/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ func (s *service) DeleteObjects(ctx context.Context, bucketName string, objects
}

func newS3Client(region string, awsEndpoint string) *s3.Client {
// Default to us-east-1 if no region is provided
if region == "" {
region = "us-east-1"
}

// Initialize AWS S3 Client
cfg, err := config.New(region)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/s3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Test_newS3Client(t *testing.T) {
if got == nil {
t.Errorf("newS3Client() returned nil when it wasn't supposed to")
}
if tt.args.region == "" && got.Options().Region != "us-west-2" {
if tt.args.region == "" && got.Options().Region != "us-east-1" {
t.Errorf("newS3Client() returned client with region set to %s", got.Options().Region)
}
if got.Options().Region != tt.args.region && tt.args.region != "" {
Expand Down

0 comments on commit 8e1f225

Please sign in to comment.