mount publisher underneath main website app
1 file changed, 15 insertions(+), 0 deletions(-)
changed files
M domain/web/website.go → domain/web/website.go
@@ -17,6 +17,7 @@ "alin.ovh/homestead/domain/analytics/goatcounter" "alin.ovh/homestead/domain/analytics/nullcounter" "alin.ovh/homestead/domain/calendar" "alin.ovh/homestead/domain/content/fetcher" + "alin.ovh/homestead/domain/content/publisher" "alin.ovh/homestead/domain/identity" "alin.ovh/homestead/domain/web/server" "alin.ovh/homestead/domain/web/templates"@@ -49,6 +50,7 @@ log *log.Logger reader storage.Reader calendar *calendar.Calendar identity *identity.Service + publisher *publisher.Service *server.App }@@ -178,12 +180,25 @@ <-firstUpdate website.identity = identity.New(cfg, log.Named("identity")) + website.publisher, err = publisher.New(&publisher.Options{ + Development: opts.Development, + BaseURL: cfg.BaseURL.JoinPath("/admin/"), + OIDC: publisher.OIDCOptions{ + Host: cfg.OIDC.Host, + ClientID: os.Getenv("OIDC_CLIENT_ID"), + ClientSecret: os.Getenv("OIDC_CLIENT_SECRET"), + }, + }, log.Named("publisher")) + if err != nil { + return nil, fault.Wrap(err, fmsg.With("could not initialise publisher")) + } mux := ihttp.NewServeMux(log.Named("http")) mux.HandleError(website.ErrorHandler) mux.Handle("/", website) mux.HandleFunc("/calendar", website.Calendar) website.identity.RegisterHandlers(mux) + website.publisher.RegisterHandlers(mux) if opts.Development { staticHandler := func(w http.ResponseWriter, r *http.Request) ihttp.Error {