zitadel/internal/static/s3/config.go
Livio Amstutz 81974b977d
fix: label policy (#1828)
* fix: font color

* fix: assets from iam when policy is default

* fix: remove multiple files

* fix mock storage

* doc: add asset api

* build assets docs

* fix operator test

* docs

* fix remove assets from org label policy and not default

* fix remove label policy assets and feature downgrade correctly

* fix storage mock

* Update docs/docs/apis/apis.md

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
2021-06-08 09:48:44 +02:00

37 lines
882 B
Go

package s3
import (
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
caos_errs "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/static"
)
type Config struct {
Endpoint string
AccessKeyID string
SecretAccessKey string
SSL bool
Location string
BucketPrefix string
MultiDelete bool
}
func (c *Config) NewStorage() (static.Storage, error) {
minioClient, err := minio.New(c.Endpoint, &minio.Options{
Creds: credentials.NewStaticV4(c.AccessKeyID, c.SecretAccessKey, ""),
Secure: c.SSL,
Region: c.Location,
})
if err != nil {
return nil, caos_errs.ThrowInternal(err, "MINIO-2n9fs", "Errors.Assets.Store.NotInitialized")
}
return &Minio{
Client: minioClient,
Location: c.Location,
BucketPrefix: c.BucketPrefix,
MultiDelete: c.MultiDelete,
}, nil
}