From 0a8065b18c8943e0d357c6ac53396d6dab20c719 Mon Sep 17 00:00:00 2001 From: xing Date: Sat, 5 Nov 2022 21:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/route.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/route/route.go b/route/route.go index 526df08..675c54b 100644 --- a/route/route.go +++ b/route/route.go @@ -8,7 +8,6 @@ import ( "github.com/gin-gonic/gin" "github/fthvgb1/wp-go/actions" "github/fthvgb1/wp-go/config" - "github/fthvgb1/wp-go/helper" "github/fthvgb1/wp-go/middleware" "github/fthvgb1/wp-go/static" "github/fthvgb1/wp-go/templates" @@ -37,8 +36,8 @@ func SetupRouter() *gin.Engine { }, }).SetTemplate() r.Use( - middleware.ValidateServerNames(), gin.Logger(), + middleware.ValidateServerNames(), middleware.RecoverAndSendMail(gin.DefaultErrorWriter), middleware.FlowLimit(config.Conf.MaxRequestSleepNum, config.Conf.MaxRequestNum, config.Conf.SleepTime), middleware.SetStaticFileCache, @@ -72,7 +71,7 @@ func SetupRouter() *gin.Engine { r.GET("/feed", actions.Feed) r.GET("/comments/feed", actions.CommentsFeed) r.POST("/comment", middleware.FlowLimit(config.Conf.MaxRequestSleepNum, 5, config.Conf.SleepTime), actions.PostComment) - if helper.IsContainInArr(gin.Mode(), []string{gin.DebugMode, gin.TestMode}) { + if gin.Mode() != gin.ReleaseMode { pprof.Register(r, "dev/pprof") } return r