mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
4a0d61d75a
* 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
31 lines
713 B
Go
31 lines
713 B
Go
package config
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"github.com/caos/zitadel/internal/static"
|
|
"github.com/caos/zitadel/internal/static/database"
|
|
"github.com/caos/zitadel/internal/static/s3"
|
|
)
|
|
|
|
type AssetStorageConfig struct {
|
|
Type string
|
|
Config map[string]interface{} `mapstructure:",remain"`
|
|
}
|
|
|
|
func (a *AssetStorageConfig) NewStorage(client *sql.DB) (static.Storage, error) {
|
|
t, ok := storage[a.Type]
|
|
if !ok {
|
|
return nil, errors.ThrowInternalf(nil, "STATIC-dsbjh", "config type %s not supported", a.Type)
|
|
}
|
|
|
|
return t(client, a.Config)
|
|
}
|
|
|
|
var storage = map[string]static.CreateStorage{
|
|
"db": database.NewStorage,
|
|
"": database.NewStorage,
|
|
"s3": s3.NewStorage,
|
|
}
|