支持注册pprof相关路由
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
||||
apiDoc "git.zhangdeman.cn/gateway/api-doc"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/gin/middleware"
|
||||
"github.com/gin-contrib/pprof"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@ -80,6 +81,10 @@ func NewServer(port int, optionList ...SetServerOptionFunc) *server {
|
||||
// 启用全局中间件
|
||||
r.Use(option.globalMiddlewareList...)
|
||||
}
|
||||
// 启用pprof, 注册相关路由
|
||||
if option.enablePprof {
|
||||
pprof.Register(r)
|
||||
}
|
||||
return &server{
|
||||
router: r,
|
||||
uiInstance: apiDoc.NewSwaggerUI(option.serverInfo, option.serverList, option.swaggerUiTheme),
|
||||
|
Reference in New Issue
Block a user