Skip to content

Commit

Permalink
Make endpoint resolver optional
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Dec 2, 2024
1 parent f1c37fa commit 853c699
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions go/vt/mysqlctl/s3backupstorage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,24 @@ func (bs *S3BackupStorage) client() (*s3.Client, error) {
return nil, err
}

bs._client = s3.NewFromConfig(cfg, func(o *s3.Options) {
o.UsePathStyle = forcePath
if retryCount >= 0 {
o.RetryMaxAttempts = retryCount
o.Retryer = &ClosedConnectionRetryer{
awsRetryer: retry.NewStandard(func(options *retry.StandardOptions) {
options.MaxAttempts = retryCount
}),
options := []func(options *s3.Options){
func(o *s3.Options) {
o.UsePathStyle = forcePath
if retryCount >= 0 {
o.RetryMaxAttempts = retryCount
o.Retryer = &ClosedConnectionRetryer{
awsRetryer: retry.NewStandard(func(options *retry.StandardOptions) {
options.MaxAttempts = retryCount
}),
}
}
}
}, s3.WithEndpointResolverV2(newEndpointResolver()))
},
}
if endpoint != "" {
options = append(options, s3.WithEndpointResolverV2(newEndpointResolver()))
}

bs._client = s3.NewFromConfig(cfg, options...)

if len(bucket) == 0 {
return nil, fmt.Errorf("--s3_backup_storage_bucket required")
Expand Down

0 comments on commit 853c699

Please sign in to comment.