Skip to content

Commit b770c9b

Browse files
authored
Merge pull request #2 from dicarne/fix_bucketlookup
Fix bucketlookup
2 parents cdbc997 + 49a4f9e commit b770c9b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

cmd/migrate_storage.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ var CmdMigrateStorage = &cli.Command{
9191
Value: "",
9292
Usage: "Minio checksum algorithm (default/md5)",
9393
},
94+
&cli.StringFlag{
95+
Name: "minio-bucket-lookup-type",
96+
Value: "",
97+
Usage: "Minio bucket lookup type",
98+
},
9499
},
95100
}
96101

@@ -220,6 +225,7 @@ func runMigrateStorage(ctx *cli.Context) error {
220225
UseSSL: ctx.Bool("minio-use-ssl"),
221226
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
222227
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
228+
BucketLookUpType: ctx.String("minio-bucket-lookup-type"),
223229
},
224230
})
225231
default:

modules/setting/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type MinioStorageConfig struct {
4747
InsecureSkipVerify bool `ini:"MINIO_INSECURE_SKIP_VERIFY"`
4848
ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"`
4949
ServeDirect bool `ini:"SERVE_DIRECT"`
50-
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE"`
50+
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE" json:",omitempty"`
5151
}
5252

5353
// Storage represents configuration of storages

modules/storage/minio.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
8585

8686
log.Info("Creating Minio storage at %s:%s with base path %s", config.Endpoint, config.Bucket, config.BasePath)
8787

88-
lookup := minio.BucketLookupAuto
89-
if config.BucketLookUpType == "dns" {
88+
var lookup minio.BucketLookupType
89+
if config.BucketLookUpType == "auto" || config.BucketLookUpType == "" {
90+
lookup = minio.BucketLookupAuto
91+
} else if config.BucketLookUpType == "dns" {
9092
lookup = minio.BucketLookupDNS
9193
} else if config.BucketLookUpType == "path" {
9294
lookup = minio.BucketLookupPath
93-
} else if config.BucketLookUpType != "auto" {
95+
} else {
9496
return nil, fmt.Errorf("invalid minio bucket lookup type: %s", config.BucketLookUpType)
9597
}
9698

0 commit comments

Comments
 (0)