Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
58 lines
2.1 KiB
Go
58 lines
2.1 KiB
Go
package provision
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/cortezaproject/corteza/server/pkg/options"
|
|
"github.com/cortezaproject/corteza/server/store"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var (
|
|
// wrapper around time.Now() that will aid service testing
|
|
now = func() *time.Time {
|
|
c := time.Now().Round(time.Second)
|
|
return &c
|
|
}
|
|
)
|
|
|
|
func Run(ctx context.Context, log *zap.Logger, s store.Storer, provisionOpt options.ProvisionOpt, authOpt options.AuthOpt) error {
|
|
log = log.Named("provision")
|
|
|
|
// Note,
|
|
ffn := []func() error{
|
|
// Migrations:
|
|
// (placeholder for all post 2022.9.x modifications)
|
|
func() error { return migratePages(ctx, log.Named("pages"), s) },
|
|
|
|
// *************************************************************************************************************
|
|
|
|
// Config (full & partial)
|
|
func() error { return importConfig(ctx, log.Named("config"), s, provisionOpt.Path) },
|
|
|
|
// *************************************************************************************************************
|
|
|
|
// Auto-discoveries and other parts that cannot be imported from static files
|
|
func() error { return emailSettings(ctx, s) },
|
|
func() error { return apigwFilters(ctx, log.Named("apigw.filters"), s) },
|
|
func() error { return authAddExternals(ctx, log.Named("auth.externals"), s) },
|
|
func() error { return oidcAutoDiscovery(ctx, log.Named("auth.oidc-auto-discovery"), s, authOpt) },
|
|
func() error { return defaultUserGroup(ctx, log.Named("user-groups"), s, authOpt) },
|
|
func() error { return defaultAuthClient(ctx, log.Named("auth.clients"), s, authOpt) },
|
|
func() error { return addAuthSuperUsers(ctx, log.Named("auth.super-users"), s, authOpt) },
|
|
func() error { return invalidateDedupRules(ctx, log.Named("compose.deduplication"), s) },
|
|
func() error { return setUsersTheme(ctx, log.Named("users.theme"), s) },
|
|
func() error { return updateWebappTheme(ctx, log.Named("webapp.themes"), s) },
|
|
func() error { return setDefaultUserGroupRefs(ctx, log.Named("user-group.references"), s, authOpt) },
|
|
}
|
|
|
|
for _, fn := range ffn {
|
|
if err := fn(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|