Skip to content

Commit

Permalink
Merge pull request #2 from dicarne/fix_bucketlookup
Browse files Browse the repository at this point in the history
Fix bucketlookup
  • Loading branch information
dicarne authored May 15, 2024
2 parents cdbc997 + 49a4f9e commit b770c9b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions cmd/migrate_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ var CmdMigrateStorage = &cli.Command{
Value: "",
Usage: "Minio checksum algorithm (default/md5)",
},
&cli.StringFlag{
Name: "minio-bucket-lookup-type",
Value: "",
Usage: "Minio bucket lookup type",
},
},
}

Expand Down Expand Up @@ -220,6 +225,7 @@ func runMigrateStorage(ctx *cli.Context) error {
UseSSL: ctx.Bool("minio-use-ssl"),
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
BucketLookUpType: ctx.String("minio-bucket-lookup-type"),
},
})
default:
Expand Down
2 changes: 1 addition & 1 deletion modules/setting/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type MinioStorageConfig struct {
InsecureSkipVerify bool `ini:"MINIO_INSECURE_SKIP_VERIFY"`
ChecksumAlgorithm string `ini:"MINIO_CHECKSUM_ALGORITHM" json:",omitempty"`
ServeDirect bool `ini:"SERVE_DIRECT"`
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE"`
BucketLookUpType string `ini:"MINIO_BUCKET_LOOKUP_TYPE" json:",omitempty"`
}

// Storage represents configuration of storages
Expand Down
8 changes: 5 additions & 3 deletions modules/storage/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,

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

lookup := minio.BucketLookupAuto
if config.BucketLookUpType == "dns" {
var lookup minio.BucketLookupType
if config.BucketLookUpType == "auto" || config.BucketLookUpType == "" {
lookup = minio.BucketLookupAuto
} else if config.BucketLookUpType == "dns" {
lookup = minio.BucketLookupDNS
} else if config.BucketLookUpType == "path" {
lookup = minio.BucketLookupPath
} else if config.BucketLookUpType != "auto" {
} else {
return nil, fmt.Errorf("invalid minio bucket lookup type: %s", config.BucketLookUpType)
}

Expand Down

0 comments on commit b770c9b

Please sign in to comment.