From a3d39f4d647eb63c6f9a58b96b209c48eaf10dee Mon Sep 17 00:00:00 2001 From: Fesaa <77553571+Fesaa@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:50:09 +0100 Subject: [PATCH] Fix log spam: move health endpoint before logger (#44) Co-authored-by: lewisakura --- main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 4010eb9..88775ec 100644 --- a/main.go +++ b/main.go @@ -109,8 +109,8 @@ func main() { } app := fiber.New(fiber.Config{ - ProxyHeader: os.Getenv("PROXY_HEADER"), - }) + ProxyHeader: os.Getenv("PROXY_HEADER"), + }) g.RDB = redis.NewClient(&redis.Options{ Addr: g.REDIS_URI, @@ -144,6 +144,11 @@ func main() { ExposeHeaders: "ETag", AllowOrigins: "https://discord.com,https://ptb.discord.com,https://canary.discord.com,https://discordapp.com,https://ptb.discordapp.com,https://canary.discordapp.com", })) + + // Add the docker health endpoint before the logger middleware, such that + // it doesn't spam the logs full with it + app.Get("/v1", routes.GET) + app.Use(logger.New()) // #region settings @@ -164,8 +169,6 @@ func main() { app.Delete("/v1", requireAuth, routes.DELETE) // #endregion - app.Get("/v1", routes.GET) - app.Get("/", func(c *fiber.Ctx) error { return c.Redirect(g.ROOT_REDIRECT, 303) })