Skip to content

Commit 0464fd3

Browse files
committed
Compatible with minion storage
1 parent ad4a27b commit 0464fd3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/config/storage.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242
GCS ProviderType = "gcs"
4343
// KS3 kingsoft ks3
4444
KS3 ProviderType = "ks3"
45+
// MINIO minio storage
46+
MINIO ProviderType = "minio"
4547
)
4648

4749
// URLTemplate storage provider url template
@@ -66,7 +68,7 @@ var endpointResolverFunc = func(urlTemplate, signingMethod string) s3.EndpointRe
6668
}
6769
}
6870

69-
var endpointResolverFuncGCS = func(urlTemplate, signingMethod string) s3.EndpointResolverFunc {
71+
var endpointResolverFuncMinio = func(urlTemplate, signingMethod string) s3.EndpointResolverFunc {
7072
return func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) {
7173
return aws.Endpoint{
7274
URL: urlTemplate,
@@ -82,6 +84,7 @@ type Storage struct {
8284
SigningMethod string `yaml:"signingMethod"`
8385
Region string `yaml:"region"`
8486
Bucket string `yaml:"bucket"`
87+
Endpoint string `yaml:"endpoint"`
8588
AccessKeyID string `yaml:"accessKeyID"`
8689
SecretAccessKey string `yaml:"secretAccessKey"`
8790
client *s3.Client
@@ -94,6 +97,9 @@ func (o *Storage) Init() {
9497
case GCS:
9598
endpointResolver = s3.EndpointResolverFromURL(URLTemplate[GCS])
9699
o.Region = "auto"
100+
case MINIO:
101+
endpointResolver = endpointResolverFuncMinio(o.Endpoint, o.SigningMethod)
102+
o.Region = "auto"
97103
case S3:
98104
default:
99105
if urlTemplate, exist := URLTemplate[o.Type]; exist && urlTemplate != "" {

0 commit comments

Comments
 (0)