mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
bc951985ed
* feat: lock users if lockout policy is set * feat: setup * feat: lock user on password failes * feat: render error * feat: lock user on command side * feat: auth_req tests * feat: lockout policy docs * feat: remove show lockout failures from proto * fix: console lockout * feat: tests * fix: tests * unlock function * add unlock button * fix migration version * lockout policy * lint * Update internal/auth/repository/eventsourcing/eventstore/auth_request.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * fix: err message * Update internal/command/setup_step4.go Co-authored-by: Silvan <silvan.reusser@gmail.com> Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Silvan <silvan.reusser@gmail.com>
103 lines
3.1 KiB
Go
103 lines
3.1 KiB
Go
package eventsourcing
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/logging"
|
|
"github.com/rakyll/statik/fs"
|
|
|
|
"github.com/caos/zitadel/internal/admin/repository/eventsourcing/eventstore"
|
|
"github.com/caos/zitadel/internal/admin/repository/eventsourcing/spooler"
|
|
admin_view "github.com/caos/zitadel/internal/admin/repository/eventsourcing/view"
|
|
"github.com/caos/zitadel/internal/command"
|
|
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
|
"github.com/caos/zitadel/internal/config/types"
|
|
"github.com/caos/zitadel/internal/eventstore/v1"
|
|
es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler"
|
|
"github.com/caos/zitadel/internal/static"
|
|
)
|
|
|
|
type Config struct {
|
|
SearchLimit uint64
|
|
Eventstore v1.Config
|
|
View types.SQL
|
|
Spooler spooler.SpoolerConfig
|
|
Domain string
|
|
APIDomain string
|
|
}
|
|
|
|
type EsRepository struct {
|
|
spooler *es_spol.Spooler
|
|
eventstore.OrgRepo
|
|
eventstore.IAMRepository
|
|
eventstore.AdministratorRepo
|
|
eventstore.FeaturesRepo
|
|
eventstore.UserRepo
|
|
}
|
|
|
|
func Start(ctx context.Context, conf Config, systemDefaults sd.SystemDefaults, command *command.Commands, static static.Storage, roles []string, localDevMode bool) (*EsRepository, error) {
|
|
es, err := v1.Start(conf.Eventstore)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
sqlClient, err := conf.View.Start()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
view, err := admin_view.StartView(sqlClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, systemDefaults, command, static, localDevMode)
|
|
assetsAPI := conf.APIDomain + "/assets/v1/"
|
|
|
|
statikLoginFS, err := fs.NewWithNamespace("login")
|
|
logging.Log("CONFI-7usEW").OnError(err).Panic("unable to start login statik dir")
|
|
|
|
statikNotificationFS, err := fs.NewWithNamespace("notification")
|
|
logging.Log("CONFI-7usEW").OnError(err).Panic("unable to start notification statik dir")
|
|
|
|
return &EsRepository{
|
|
spooler: spool,
|
|
OrgRepo: eventstore.OrgRepo{
|
|
Eventstore: es,
|
|
View: view,
|
|
SearchLimit: conf.SearchLimit,
|
|
SystemDefaults: systemDefaults,
|
|
},
|
|
IAMRepository: eventstore.IAMRepository{
|
|
Eventstore: es,
|
|
View: view,
|
|
SystemDefaults: systemDefaults,
|
|
SearchLimit: conf.SearchLimit,
|
|
Roles: roles,
|
|
PrefixAvatarURL: assetsAPI,
|
|
LoginDir: statikLoginFS,
|
|
NotificationDir: statikNotificationFS,
|
|
LoginTranslationFileContents: make(map[string][]byte),
|
|
NotificationTranslationFileContents: make(map[string][]byte),
|
|
},
|
|
AdministratorRepo: eventstore.AdministratorRepo{
|
|
View: view,
|
|
},
|
|
FeaturesRepo: eventstore.FeaturesRepo{
|
|
Eventstore: es,
|
|
View: view,
|
|
SearchLimit: conf.SearchLimit,
|
|
SystemDefaults: systemDefaults,
|
|
},
|
|
UserRepo: eventstore.UserRepo{
|
|
Eventstore: es,
|
|
View: view,
|
|
SearchLimit: conf.SearchLimit,
|
|
SystemDefaults: systemDefaults,
|
|
PrefixAvatarURL: assetsAPI,
|
|
},
|
|
}, nil
|
|
}
|
|
|
|
func (repo *EsRepository) Health(ctx context.Context) error {
|
|
return nil
|
|
}
|