From be59be1795d9ff2f68add545f39fc907c81bdf6a Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 2 Oct 2024 12:10:38 +0200 Subject: [PATCH] feat: add recoverer + request-id http middlewares --- internal/admin/server.go | 2 ++ internal/proxy/server.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/internal/admin/server.go b/internal/admin/server.go index d3677d1..3efd340 100644 --- a/internal/admin/server.go +++ b/internal/admin/server.go @@ -116,7 +116,9 @@ func (s *Server) run(parentCtx context.Context, addrs chan net.Addr, errs chan e router.Use(middleware.RealIP) } + router.Use(middleware.RequestID) router.Use(middleware.RequestLogger(bouncerChi.NewLogFormatter())) + router.Use(middleware.Recoverer) if s.serverConfig.Sentry.DSN != "" { logger.Info(ctx, "enabling sentry http middleware") diff --git a/internal/proxy/server.go b/internal/proxy/server.go index 862e692..84534ec 100644 --- a/internal/proxy/server.go +++ b/internal/proxy/server.go @@ -121,7 +121,9 @@ func (s *Server) run(parentCtx context.Context, addrs chan net.Addr, errs chan e router.Use(middleware.RealIP) } + router.Use(middleware.RequestID) router.Use(middleware.RequestLogger(bouncerChi.NewLogFormatter())) + router.Use(middleware.Recoverer) if s.serverConfig.Sentry.DSN != "" { logger.Info(ctx, "enabling sentry http middleware")