Fix support for min.io with Google Cloud Storage (#152)
Adds MINIO_BUCKET_SEP options to control the separator string
This commit is contained in:
@@ -108,7 +108,7 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
|
||||
if c.Storage.MinioEndpoint != "" {
|
||||
var bucket = svcPath
|
||||
if c.Storage.MinioBucket != "" {
|
||||
bucket = c.Storage.MinioBucket + "/" + svcPath
|
||||
bucket = c.Storage.MinioBucket + c.Storage.MinioBucketSep + svcPath
|
||||
}
|
||||
|
||||
DefaultObjectStore, err = minio.New(bucket, minio.Options{
|
||||
|
||||
@@ -17,6 +17,7 @@ type (
|
||||
MinioSecretKey string `env:"MINIO_SECRET_KEY"`
|
||||
MinioSSECKey string `env:"MINIO_SSEC_KEY"`
|
||||
MinioBucket string `env:"MINIO_BUCKET"`
|
||||
MinioBucketSep string `env:"MINIO_BUCKET_SEP"`
|
||||
MinioStrict bool `env:"MINIO_STRICT"`
|
||||
}
|
||||
)
|
||||
@@ -24,9 +25,10 @@ type (
|
||||
// ObjectStore initializes and returns a ObjectStoreOpt with default values
|
||||
func ObjectStore() (o *ObjectStoreOpt) {
|
||||
o = &ObjectStoreOpt{
|
||||
Path: "var/store",
|
||||
MinioSecure: true,
|
||||
MinioStrict: false,
|
||||
Path: "var/store",
|
||||
MinioSecure: true,
|
||||
MinioBucketSep: "/",
|
||||
MinioStrict: false,
|
||||
}
|
||||
|
||||
fill(o)
|
||||
|
||||
@@ -30,6 +30,11 @@ props:
|
||||
- name: minioBucket
|
||||
env: MINIO_BUCKET
|
||||
|
||||
- name: minioBucketSep
|
||||
env: MINIO_BUCKET_SEP
|
||||
default: "/"
|
||||
description: Used between MINIO_BUCKET and the service name (e.g system). Ignored if MINIO_BUCKET is not set. Required in latest versions of min.io since "/" is not accepted anymore in bucket names.
|
||||
|
||||
- name: minioStrict
|
||||
type: bool
|
||||
env: MINIO_STRICT
|
||||
|
||||
@@ -123,7 +123,7 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
|
||||
if c.Storage.MinioEndpoint != "" {
|
||||
var bucket = svcPath
|
||||
if c.Storage.MinioBucket != "" {
|
||||
bucket = c.Storage.MinioBucket + "/" + svcPath
|
||||
bucket = c.Storage.MinioBucket + c.Storage.MinioBucketSep + svcPath
|
||||
}
|
||||
|
||||
DefaultObjectStore, err = minio.New(bucket, minio.Options{
|
||||
|
||||
Reference in New Issue
Block a user