mirror of
https://github.com/gofiber/fiber.git
synced 2025-05-01 21:22:21 +00:00
* internal: revert linting changes Changes to the internal package should not have been made in 167a8b5e9421e0ab51fbf44c5621632f4a1a90c5. * middleware/monitor: revert changes to exported field "ChartJSURL" This is a breaking change introduced in 167a8b5e9421e0ab51fbf44c5621632f4a1a90c5. * middleware/monitor: fix error checking Fix the errorenous error checking introduced in 167a8b5e9421e0ab51fbf44c5621632f4a1a90c5. * 🐛 Bug: Fix issues introduced in linting PR #2319 * 🐛 Bug: Fix issues introduced in linting PR #2319 * Bug: Fix issues introduced in linting PR #2319 --------- Co-authored-by: René Werner <rene@gofiber.io>
42 lines
788 B
Go
42 lines
788 B
Go
package pprof
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
// Config defines the config for middleware.
|
|
type Config struct {
|
|
// Next defines a function to skip this middleware when returned true.
|
|
//
|
|
// Optional. Default: nil
|
|
Next func(c *fiber.Ctx) bool
|
|
|
|
// Prefix defines a URL prefix added before "/debug/pprof".
|
|
// Note that it should start with (but not end with) a slash.
|
|
// Example: "/federated-fiber"
|
|
//
|
|
// Optional. Default: ""
|
|
Prefix string
|
|
}
|
|
|
|
var ConfigDefault = Config{
|
|
Next: nil,
|
|
}
|
|
|
|
func configDefault(config ...Config) Config {
|
|
// Return default config if nothing provided
|
|
if len(config) < 1 {
|
|
return ConfigDefault
|
|
}
|
|
|
|
// Override default config
|
|
cfg := config[0]
|
|
|
|
// Set default values
|
|
if cfg.Next == nil {
|
|
cfg.Next = ConfigDefault.Next
|
|
}
|
|
|
|
return cfg
|
|
}
|