feat: 配置优化梳理

This commit is contained in:
tbphp
2025-07-11 21:23:56 +08:00
parent 1368792aa0
commit f655de3cda
20 changed files with 485 additions and 553 deletions

View File

@@ -18,16 +18,6 @@ import (
// Logger creates a high-performance logging middleware
func Logger(config types.LogConfig) gin.HandlerFunc {
return func(c *gin.Context) {
// Check if request logging is enabled
if !config.EnableRequest {
// Don't log requests, only process them
c.Next()
// Only log errors
if c.Writer.Status() >= 400 {
logrus.Errorf("Error %d: %s %s", c.Writer.Status(), c.Request.Method, c.Request.URL.Path)
}
return
}
start := time.Now()
path := c.Request.URL.Path
@@ -127,10 +117,6 @@ func CORS(config types.CORSConfig) gin.HandlerFunc {
// Auth creates an authentication middleware
func Auth(config types.AuthConfig) gin.HandlerFunc {
return func(c *gin.Context) {
if !config.Enabled {
c.Next()
return
}
// Skip authentication for management endpoints
path := c.Request.URL.Path