forked from Mirrors/gomuks
server: add config option to enable pprof endpoints
This commit is contained in:
parent
08bea53cf1
commit
038e62120b
2 changed files with 9 additions and 4 deletions
|
@ -36,10 +36,11 @@ type Config struct {
|
|||
}
|
||||
|
||||
type WebConfig struct {
|
||||
ListenAddress string `yaml:"listen_address"`
|
||||
Username string `yaml:"username"`
|
||||
PasswordHash string `yaml:"password_hash"`
|
||||
TokenKey string `yaml:"token_key"`
|
||||
ListenAddress string `yaml:"listen_address"`
|
||||
Username string `yaml:"username"`
|
||||
PasswordHash string `yaml:"password_hash"`
|
||||
TokenKey string `yaml:"token_key"`
|
||||
DebugEndpoints bool `yaml:"debug_endpoints"`
|
||||
}
|
||||
|
||||
var defaultConfig = Config{
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"errors"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -52,6 +53,9 @@ func (gmx *Gomuks) StartServer() {
|
|||
gmx.AuthMiddleware,
|
||||
)
|
||||
router := http.NewServeMux()
|
||||
if gmx.Config.Web.DebugEndpoints {
|
||||
router.Handle("/debug/", http.DefaultServeMux)
|
||||
}
|
||||
router.Handle("/_gomuks/", apiHandler)
|
||||
if frontend, err := fs.Sub(web.Frontend, "dist"); err != nil {
|
||||
gmx.Log.Warn().Msg("Frontend not found")
|
||||
|
|
Loading…
Add table
Reference in a new issue