1
0

fix: fix logger style err and gin warning

This commit is contained in:
2026-07-17 12:12:14 +08:00
parent 44e1415194
commit 8941f625c8
2 changed files with 60 additions and 8 deletions

View File

@@ -77,7 +77,22 @@ func fetchClientInfo(c *gin.Context) (ua, ip string) {
// Run sets up the Gin engine with all routes bound to the handler and starts
// listening on the configured web port.
func Run(handler *Handler) error {
if handler.Cfg.Others.Debug {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
r := gin.Default()
err := r.SetTrustedProxies([]string{
"127.0.0.1", // IPv4 本地回环
"::1", // IPv6 本地回环
})
if err != nil {
return err
}
registerRoutes(r, handler)
return r.Run(fmt.Sprintf(":%d", handler.Cfg.Web.Port))
}