fix: update config to commands (and queries) (#1342)

* fix: adaot config to commands (and queries)

* remove dependency on vv2 in v1

* add queries user to operator

* set password for queries on tests

* set password for queries on tests

* fix config
This commit is contained in:
Livio Amstutz
2021-02-24 11:17:39 +01:00
committed by GitHub
parent 438daebdb9
commit 8dcbbc87ca
101 changed files with 1122 additions and 1078 deletions

View File

@@ -11,7 +11,7 @@ import (
)
type ApplicationRepo struct {
Commands *command.CommandSide
Commands *command.Commands
View *view.View
}

View File

@@ -30,7 +30,7 @@ import (
)
type AuthRequestRepo struct {
Command *command.CommandSide
Command *command.Commands
AuthRequests cache.AuthRequestCache
View *view.View

View File

@@ -10,7 +10,7 @@ import (
type IAMRepository struct {
IAMID string
IAMV2QuerySide *query.QuerySide
IAMV2QuerySide *query.Queries
}
func (repo *IAMRepository) GetIAM(ctx context.Context) (*model.IAM, error) {

View File

@@ -20,7 +20,7 @@ import (
)
type KeyRepository struct {
Commands *command.CommandSide
Commands *command.Commands
Eventstore *eventstore.Eventstore
View *view.View
SigningKeyRotationCheck time.Duration

View File

@@ -2,7 +2,6 @@ package eventsourcing
import (
"context"
"github.com/caos/zitadel/internal/eventstore/v1"
"github.com/caos/zitadel/internal/api/authz"
"github.com/caos/zitadel/internal/auth/repository/eventsourcing/eventstore"
@@ -14,6 +13,8 @@ import (
sd "github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/config/types"
"github.com/caos/zitadel/internal/crypto"
es2 "github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/eventstore/v1"
es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler"
"github.com/caos/zitadel/internal/id"
key_model "github.com/caos/zitadel/internal/key/model"
@@ -43,12 +44,11 @@ type EsRepository struct {
eventstore.IAMRepository
}
func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, command *command.CommandSide, authZRepo *authz_repo.EsRepository) (*EsRepository, error) {
func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, command *command.Commands, queries *query.Queries, authZRepo *authz_repo.EsRepository, esV2 *es2.Eventstore) (*EsRepository, error) {
es, err := v1.Start(conf.Eventstore)
if err != nil {
return nil, err
}
esV2 := es.V2()
sqlClient, err := conf.View.Start()
if err != nil {
@@ -71,11 +71,6 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, co
return nil, err
}
iamV2Query, err := query.StartQuerySide(&query.Config{Eventstore: esV2, SystemDefaults: systemDefaults})
if err != nil {
return nil, err
}
keyChan := make(chan *key_model.KeyView)
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, systemDefaults, keyChan)
locker := spooler.NewLocker(sqlClient)
@@ -145,7 +140,7 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, co
},
eventstore.IAMRepository{
IAMID: systemDefaults.IamID,
IAMV2QuerySide: iamV2Query,
IAMV2QuerySide: queries,
},
}, nil
}