mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-03 06:08:42 +00:00
Only enable debug endpoints if log level is debug or below (#1160)
This commit is contained in:
parent
d5cdd2bb04
commit
d8f598c2ad
1 changed files with 16 additions and 13 deletions
|
@ -16,6 +16,7 @@ package router
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/server/api"
|
||||
"github.com/woodpecker-ci/woodpecker/server/api/debug"
|
||||
|
@ -155,6 +156,7 @@ func apiRoutes(e *gin.Engine) {
|
|||
secrets.DELETE("/:secret", api.DeleteGlobalSecret)
|
||||
}
|
||||
|
||||
if zerolog.GlobalLevel() <= zerolog.DebugLevel {
|
||||
debugger := e.Group("/api/debug")
|
||||
{
|
||||
debugger.Use(session.MustAdmin())
|
||||
|
@ -169,6 +171,7 @@ func apiRoutes(e *gin.Engine) {
|
|||
debugger.POST("/pprof/symbol", debug.SymbolHandler())
|
||||
debugger.GET("/pprof/trace", debug.TraceHandler())
|
||||
}
|
||||
}
|
||||
|
||||
logLevel := e.Group("/api/log-level")
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue