fix: cleanup some todos (#3642)

* cleanup todo

* fix: some todos
This commit is contained in:
Livio Amstutz
2022-05-16 16:35:49 +02:00
committed by GitHub
parent 5c0f527a49
commit 3a63fb765a
45 changed files with 130 additions and 199 deletions

View File

@@ -28,13 +28,12 @@ func (h *handler) Eventstore() v1.Eventstore {
return h.es
}
func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, static static.Storage, loginPrefix string) []query.Handler {
func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, static static.Storage) []query.Handler {
handlers := []query.Handler{}
if static != nil {
handlers = append(handlers, newStyling(
handler{view, bulkLimit, configs.cycleDuration("Styling"), errorCount, es},
static,
loginPrefix))
static))
}
return handlers
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/muesli/gamut"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/api/ui/login"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/eventstore"
v1 "github.com/zitadel/zitadel/internal/eventstore/v1"
@@ -31,16 +32,13 @@ type Styling struct {
handler
static static.Storage
subscription *v1.Subscription
resourceUrl string
}
func newStyling(handler handler, static static.Storage, loginPrefix string) *Styling {
func newStyling(handler handler, static static.Storage) *Styling {
h := &Styling{
handler: handler,
static: static,
}
h.resourceUrl = loginPrefix + "/resources/dynamic" //TODO: ?
h.subscribe()
return h
@@ -218,7 +216,7 @@ func (m *Styling) writeFile(policy *iam_model.LabelPolicyView) (io.Reader, int64
}
cssContent += "}"
if policy.FontURL != "" {
cssContent += fmt.Sprintf(fontFaceTemplate, fontname, m.resourceUrl, policy.AggregateID, policy.FontURL)
cssContent += fmt.Sprintf(fontFaceTemplate, fontname, login.HandlerPrefix+login.EndpointDynamicResources, policy.AggregateID, policy.FontURL)
}
cssContent += ".lgn-dark-theme {"
if policy.PrimaryColorDark != "" {

View File

@@ -22,7 +22,7 @@ type EsRepository struct {
eventstore.AdministratorRepo
}
func Start(conf Config, static static.Storage, dbClient *sql.DB, loginPrefix string) (*EsRepository, error) {
func Start(conf Config, static static.Storage, dbClient *sql.DB) (*EsRepository, error) {
es, err := v1.Start(dbClient)
if err != nil {
return nil, err
@@ -32,7 +32,7 @@ func Start(conf Config, static static.Storage, dbClient *sql.DB, loginPrefix str
return nil, err
}
spool := spooler.StartSpooler(conf.Spooler, es, view, dbClient, static, loginPrefix)
spool := spooler.StartSpooler(conf.Spooler, es, view, dbClient, static)
return &EsRepository{
spooler: spool,

View File

@@ -18,12 +18,12 @@ type SpoolerConfig struct {
Handlers handler.Configs
}
func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, static static.Storage, loginPrefix string) *spooler.Spooler {
func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, static static.Storage) *spooler.Spooler {
spoolerConfig := spooler.Config{
Eventstore: es,
Locker: &locker{dbClient: sql},
ConcurrentWorkers: c.ConcurrentWorkers,
ViewHandlers: handler.Register(c.Handlers, c.BulkLimit, c.FailureCountUntilSkip, view, es, static, loginPrefix),
ViewHandlers: handler.Register(c.Handlers, c.BulkLimit, c.FailureCountUntilSkip, view, es, static),
}
spool := spoolerConfig.New()
spool.Start()