Skip to content

Commit

Permalink
change into EnableDuakStack
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroki6 <[email protected]>
  • Loading branch information
Hiroki6 committed Aug 5, 2024
1 parent 14990e3 commit 400c633
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type S3ClientOpts struct {
RoleSessionName string
UseSDKCreds bool
EncryptOpts EncryptOpts
DisableDualStack bool
EnableDualStack bool
}

type s3client struct {
Expand Down Expand Up @@ -193,9 +193,6 @@ func NewS3Client(ctx context.Context, opts S3ClientOpts) (S3Client, error) {
if opts.Trace {
minioClient.TraceOn(log.StandardLogger().Out)
}
if opts.DisableDualStack {
minioClient.SetS3EnableDualstack(false)
}
if opts.EncryptOpts.KmsKeyId != "" && opts.EncryptOpts.ServerSideCustomerKey != "" {
return nil, errors.New("EncryptOpts.KmsKeyId and EncryptOpts.SSECPassword cannot be set together")
}
Expand All @@ -204,6 +201,7 @@ func NewS3Client(ctx context.Context, opts S3ClientOpts) (S3Client, error) {
return nil, errors.New("Secure must be set if EncryptOpts.SSECPassword is set")
}

minioClient.SetS3EnableDualstack(s3cli.EnableDualStack)
s3cli.ctx = ctx
s3cli.minioClient = minioClient

Expand Down
2 changes: 2 additions & 0 deletions s3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestNewS3Client(t *testing.T) {
RoleSessionName: "",
UseSDKCreds: false,
EncryptOpts: EncryptOpts{Enabled: true, ServerSideCustomerKey: "", KmsKeyId: "", KmsEncryptionContext: ""},
EnableDualStack: true,
}
s3If, err := NewS3Client(context.Background(), opts)
assert.NoError(t, err)
Expand All @@ -36,6 +37,7 @@ func TestNewS3Client(t *testing.T) {
assert.Equal(t, opts.Trace, s3cli.Trace)
assert.Equal(t, opts.EncryptOpts, s3cli.EncryptOpts)
assert.Equal(t, opts.AddressingStyle, s3cli.AddressingStyle)
assert.Equal(t, opts.EnableDualStack, s3cli.EnableDualStack)
// s3cli.minioClient.
// s3client.minioClient
}
Expand Down

0 comments on commit 400c633

Please sign in to comment.