Skip to content

Commit

Permalink
s3 auto resolve fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Oct 27, 2023
1 parent 88001e1 commit 95d8b9f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions flow/connectors/utils/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
Expand Down Expand Up @@ -101,10 +102,16 @@ func CreateS3Client(s3Creds S3PeerCredentials) (*s3.S3, error) {
return nil, fmt.Errorf("failed to get AWS secrets: %w", err)
}

sess := session.Must(session.NewSession(&aws.Config{
config := &aws.Config{
Region: aws.String(awsSecrets.Region),
Endpoint: aws.String(awsSecrets.Endpoint),
}))
}

if s3Creds.AccessKeyID != "" && s3Creds.SecretAccessKey != "" {
config.Credentials = credentials.NewStaticCredentials(s3Creds.AccessKeyID, s3Creds.SecretAccessKey, "")
}

sess := session.Must(session.NewSession(config))

s3svc := s3.New(sess)
return s3svc, nil
Expand Down

0 comments on commit 95d8b9f

Please sign in to comment.