Skip to content

Commit

Permalink
fix: Add middleware earlier #1775 (#1776)
Browse files Browse the repository at this point in the history
Closes #1775

Co-authored-by: Michał Turek <raucously@gmail.com>
  • Loading branch information
abador and slayful committed Sep 23, 2021
1 parent 131e62e commit b9d253e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/daemon/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func ServePublic(r driver.Registry, wg *sync.WaitGroup, cmd *cobra.Command, args
for _, mw := range modifiers.mwf {
n.UseFunc(mw)
}
n.Use(reqlog.NewMiddlewareFromLogger(l, "public#"+c.SelfPublicURL(nil).String()))
n.Use(sqa(ctx, cmd, r))
n.Use(r.PrometheusManager())

router := x.NewRouterPublic()
csrf := x.NewCSRFHandler(router, r)
Expand All @@ -92,9 +95,6 @@ func ServePublic(r driver.Registry, wg *sync.WaitGroup, cmd *cobra.Command, args

r.RegisterPublicRoutes(ctx, router)
r.PrometheusManager().RegisterRouter(router.Router)
n.Use(reqlog.NewMiddlewareFromLogger(l, "public#"+c.SelfPublicURL(nil).String()))
n.Use(sqa(ctx, cmd, r))
n.Use(r.PrometheusManager())

if tracer := r.Tracer(ctx); tracer.IsLoaded() {
n.Use(tracer)
Expand Down Expand Up @@ -141,13 +141,13 @@ func ServeAdmin(r driver.Registry, wg *sync.WaitGroup, cmd *cobra.Command, args
for _, mw := range modifiers.mwf {
n.UseFunc(mw)
}
n.Use(reqlog.NewMiddlewareFromLogger(l, "admin#"+c.SelfPublicURL(nil).String()))
n.Use(sqa(ctx, cmd, r))
n.Use(r.PrometheusManager())

router := x.NewRouterAdmin()
r.RegisterAdminRoutes(ctx, router)
r.PrometheusManager().RegisterRouter(router.Router)
n.Use(reqlog.NewMiddlewareFromLogger(l, "admin#"+c.SelfPublicURL(nil).String()))
n.Use(sqa(ctx, cmd, r))
n.Use(r.PrometheusManager())

if tracer := r.Tracer(ctx); tracer.IsLoaded() {
n.Use(tracer)
Expand Down

0 comments on commit b9d253e

Please sign in to comment.