Skip to content

Commit 8292553

Browse files
committed
fix: minio storage bug
1 parent 07b7ed9 commit 8292553

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

pkg/config/storage.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ var endpointResolverFunc = func(urlTemplate, signingMethod string) s3.EndpointRe
7171
var endpointResolverFuncMinio = func(urlTemplate, signingMethod string) s3.EndpointResolverFunc {
7272
return func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
7373
return aws.Endpoint{
74-
URL: urlTemplate,
75-
SigningRegion: region,
76-
SigningMethod: signingMethod,
74+
URL: urlTemplate,
75+
SigningRegion: region,
76+
SigningMethod: signingMethod,
77+
HostnameImmutable: true,
7778
}, nil
7879
}
7980
}

pkg/config/storage_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func TestStorage_Init(t *testing.T) {
2424
SigningMethod string
2525
Region string
2626
Bucket string
27+
Endpoint string
2728
AccessKeyID string
2829
SecretAccessKey string
2930
}
@@ -75,6 +76,18 @@ func TestStorage_Init(t *testing.T) {
7576
SecretAccessKey: os.Getenv("kodo_secret_access_key"),
7677
},
7778
},
79+
{
80+
name: "test-minio",
81+
fields: fields{
82+
Type: MINIO,
83+
SigningMethod: "v4",
84+
Region: os.Getenv("s3_region"),
85+
Bucket: os.Getenv("s3_bucket"),
86+
Endpoint: os.Getenv("s3_endpoint"),
87+
AccessKeyID: os.Getenv("s3_access_key_id"),
88+
SecretAccessKey: os.Getenv("s3_secret_access_key"),
89+
},
90+
},
7891
}
7992
for _, tt := range tests {
8093
t.Run(tt.name, func(t *testing.T) {
@@ -83,6 +96,7 @@ func TestStorage_Init(t *testing.T) {
8396
SigningMethod: tt.fields.SigningMethod,
8497
Region: tt.fields.Region,
8598
Bucket: tt.fields.Bucket,
99+
Endpoint: tt.fields.Endpoint,
86100
AccessKeyID: tt.fields.AccessKeyID,
87101
SecretAccessKey: tt.fields.SecretAccessKey,
88102
}

0 commit comments

Comments
 (0)