add system config (#71)

This commit is contained in:
Fabi
2020-04-23 10:43:39 +02:00
committed by GitHub
parent 8464cfa4fe
commit ff11cdba40
8 changed files with 42 additions and 30 deletions

View File

@@ -2,6 +2,7 @@ package eventsourcing
import (
"context"
sd "github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
"strconv"
@@ -24,18 +25,16 @@ type ProjectEventstore struct {
type ProjectConfig struct {
es_int.Eventstore
Cache *config.CacheConfig
PasswordSaltCost int
ClientSecretGenerator crypto.GeneratorConfig
Cache *config.CacheConfig
}
func StartProject(conf ProjectConfig) (*ProjectEventstore, error) {
func StartProject(conf ProjectConfig, systemDefaults sd.SystemDefaults) (*ProjectEventstore, error) {
projectCache, err := StartCache(conf.Cache)
if err != nil {
return nil, err
}
passwordAlg := crypto.NewBCrypt(conf.PasswordSaltCost)
pwGenerator := crypto.NewHashGenerator(conf.ClientSecretGenerator, passwordAlg)
passwordAlg := crypto.NewBCrypt(systemDefaults.SecretGenerator.PasswordSaltCost)
pwGenerator := crypto.NewHashGenerator(systemDefaults.SecretGenerator.ClientSecretGenerator, passwordAlg)
idGenerator := sonyflake.NewSonyflake(sonyflake.Settings{})
return &ProjectEventstore{
Eventstore: conf.Eventstore,