Redact admin prefix when registering profiling handlers, too
This commit is contained in:
parent
adaa7378ff
commit
de94c5eb49
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
@ -16,6 +17,10 @@ import (
|
||||||
func registerProfileHandler(mux *httprouter.Router, verb, path string, handler http.HandlerFunc) {
|
func registerProfileHandler(mux *httprouter.Router, verb, path string, handler http.HandlerFunc) {
|
||||||
mux.HandlerFunc(verb, path, handler)
|
mux.HandlerFunc(verb, path, handler)
|
||||||
|
|
||||||
|
if Redact && AdminPrefix != "" {
|
||||||
|
path = strings.ReplaceAll(path, AdminPrefix, "/<admin_prefix>")
|
||||||
|
}
|
||||||
|
|
||||||
if Handlers {
|
if Handlers {
|
||||||
fmt.Printf("%s | SERVE: Registered handler for %s\n",
|
fmt.Printf("%s | SERVE: Registered handler for %s\n",
|
||||||
time.Now().Format(logDate),
|
time.Now().Format(logDate),
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
||||||
ReleaseVersion string = "4.0.1"
|
ReleaseVersion string = "4.0.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue