Skip to content

Commit

Permalink
Fix log spam: move health endpoint before logger (#44)
Browse files Browse the repository at this point in the history
Co-authored-by: lewisakura <[email protected]>
  • Loading branch information
Fesaa and lewisakura authored Nov 29, 2024
1 parent faa4c77 commit a3d39f4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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)
})
Expand Down

0 comments on commit a3d39f4

Please sign in to comment.