mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
feat: store assets in database (#3290)
* feat: use database as asset storage * being only uploading assets if allowed * tests * fixes * cleanup after merge * renaming * various fixes * fix: change to repository event types and removed unused code * feat: set default features * error handling * error handling and naming * fix tests * fix tests * fix merge * rename
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package s3
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/static"
|
||||
)
|
||||
@@ -34,3 +38,15 @@ func (c *Config) NewStorage() (static.Storage, error) {
|
||||
MultiDelete: c.MultiDelete,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewStorage(_ *sql.DB, rawConfig map[string]interface{}) (static.Storage, error) {
|
||||
configData, err := json.Marshal(rawConfig)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "MINIO-Ef2f2", "could not map config")
|
||||
}
|
||||
c := new(Config)
|
||||
if err := json.Unmarshal(configData, c); err != nil {
|
||||
return nil, errors.ThrowInternal(err, "MINIO-GB4nw", "could not map config")
|
||||
}
|
||||
return c.NewStorage()
|
||||
}
|
||||
|
Reference in New Issue
Block a user