mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 13:57:32 +00:00
207842be91
* fix: alway do permission check * fix: alway do permission check * fix: add project query to applications search request * fix: add email template to statik * fix: org members
65 lines
1.8 KiB
Go
65 lines
1.8 KiB
Go
package eventsourcing
|
|
|
|
import (
|
|
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
|
"github.com/caos/zitadel/internal/config/types"
|
|
es_int "github.com/caos/zitadel/internal/eventstore"
|
|
es_spol "github.com/caos/zitadel/internal/eventstore/spooler"
|
|
"github.com/caos/zitadel/internal/i18n"
|
|
"github.com/caos/zitadel/internal/notification/repository/eventsourcing/handler"
|
|
"github.com/caos/zitadel/internal/notification/repository/eventsourcing/spooler"
|
|
noti_view "github.com/caos/zitadel/internal/notification/repository/eventsourcing/view"
|
|
es_usr "github.com/caos/zitadel/internal/user/repository/eventsourcing"
|
|
"golang.org/x/text/language"
|
|
"net/http"
|
|
)
|
|
|
|
type Config struct {
|
|
DefaultLanguage language.Tag
|
|
Eventstore es_int.Config
|
|
View types.SQL
|
|
Spooler spooler.SpoolerConfig
|
|
}
|
|
|
|
type EsRepository struct {
|
|
spooler *es_spol.Spooler
|
|
}
|
|
|
|
func Start(conf Config, dir http.FileSystem, systemDefaults sd.SystemDefaults) (*EsRepository, error) {
|
|
es, err := es_int.Start(conf.Eventstore)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
sqlClient, err := conf.View.Start()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
view, err := noti_view.StartView(sqlClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
user, err := es_usr.StartUser(es_usr.UserConfig{
|
|
Eventstore: es,
|
|
Cache: conf.Eventstore.Cache,
|
|
}, systemDefaults)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
i18n, err := i18n.NewTranslator(dir, i18n.TranslatorConfig{DefaultLanguage: conf.DefaultLanguage})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
eventstoreRepos := handler.EventstoreRepos{UserEvents: user}
|
|
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, eventstoreRepos, systemDefaults, i18n, dir)
|
|
|
|
return &EsRepository{
|
|
spool,
|
|
}, nil
|
|
}
|
|
|
|
func (repo *EsRepository) Health() error {
|
|
return nil
|
|
}
|