fix: fix logger style err and gin warning
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user