Skip to content

Commit

Permalink
add: simple developer monitoring, only availible if general.productio…
Browse files Browse the repository at this point in the history
…n is set to false
  • Loading branch information
HilkopterBob committed Oct 28, 2024
1 parent b55b217 commit e2edf9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/gofiber/contrib/otelfiber"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/healthcheck"
"github.com/gofiber/fiber/v2/middleware/monitor"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/template/html/v2"
"github.com/golang-jwt/jwt/v5"
Expand Down Expand Up @@ -49,6 +50,12 @@ func NewServer(params ServerParams) *fiber.App {
params.Logger.Info("Added OpenTelemetry Middleware.")
}

// Middleware for simple resource Monitor
// only use in Non-Production mode
if !params.Config.GetBool("general.production") {
app.Get("/monitor", monitor.New(monitor.Config{Title: "PackageLock Dev Monitoring Page"}))
}

// Middleware for logging
app.Use(fiberzap.New(fiberzap.Config{
Logger: params.Logger,
Expand All @@ -59,7 +66,6 @@ func NewServer(params ServerParams) *fiber.App {
app.Use(recover.New())
params.Logger.Info("Added Recovery Middleware.")


// Middleware for healthcheck
app.Use(healthcheck.New(healthcheck.Config{
LivenessProbe: func(c *fiber.Ctx) bool {
Expand Down

0 comments on commit e2edf9a

Please sign in to comment.