mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
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:
@@ -2,6 +2,8 @@ package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/config/types"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
usr_repo "github.com/caos/zitadel/internal/repository/user"
|
||||
|
||||
@@ -13,7 +15,7 @@ import (
|
||||
"github.com/caos/zitadel/internal/telemetry/tracing"
|
||||
)
|
||||
|
||||
type QuerySide struct {
|
||||
type Queries struct {
|
||||
iamID string
|
||||
eventstore *eventstore.Eventstore
|
||||
idGenerator id.Generator
|
||||
@@ -21,27 +23,26 @@ type QuerySide struct {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Eventstore *eventstore.Eventstore
|
||||
SystemDefaults sd.SystemDefaults
|
||||
Eventstore types.SQLUser
|
||||
}
|
||||
|
||||
func StartQuerySide(config *Config) (repo *QuerySide, err error) {
|
||||
repo = &QuerySide{
|
||||
iamID: config.SystemDefaults.IamID,
|
||||
eventstore: config.Eventstore,
|
||||
func StartQueries(eventstore *eventstore.Eventstore, defaults sd.SystemDefaults) (repo *Queries, err error) {
|
||||
repo = &Queries{
|
||||
iamID: defaults.IamID,
|
||||
eventstore: eventstore,
|
||||
idGenerator: id.SonyFlakeGenerator,
|
||||
}
|
||||
iam_repo.RegisterEventMappers(repo.eventstore)
|
||||
usr_repo.RegisterEventMappers(repo.eventstore)
|
||||
|
||||
repo.secretCrypto, err = crypto.NewAESCrypto(config.SystemDefaults.IDPConfigVerificationKey)
|
||||
repo.secretCrypto, err = crypto.NewAESCrypto(defaults.IDPConfigVerificationKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
func (r *QuerySide) IAMByID(ctx context.Context, id string) (_ *iam_model.IAM, err error) {
|
||||
func (r *Queries) IAMByID(ctx context.Context, id string) (_ *iam_model.IAM, err error) {
|
||||
readModel, err := r.iamByID(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -50,7 +51,7 @@ func (r *QuerySide) IAMByID(ctx context.Context, id string) (_ *iam_model.IAM, e
|
||||
return readModelToIAM(readModel), nil
|
||||
}
|
||||
|
||||
func (r *QuerySide) iamByID(ctx context.Context, id string) (_ *ReadModel, err error) {
|
||||
func (r *Queries) iamByID(ctx context.Context, id string) (_ *ReadModel, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
|
Reference in New Issue
Block a user