mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-09 20:13:40 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
31 lines
725 B
Go
31 lines
725 B
Go
package config
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/zitadel/zitadel/internal/errors"
|
|
"github.com/zitadel/zitadel/internal/static"
|
|
"github.com/zitadel/zitadel/internal/static/database"
|
|
"github.com/zitadel/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,
|
|
}
|