调整工具类的方法,优化方法调用及增加迁移工具及其用法

This commit is contained in:
2025-12-04 22:30:48 +08:00
parent de8fc13f18
commit 0650feb0d2
28 changed files with 3753 additions and 162 deletions

View File

@@ -5,8 +5,6 @@ import (
"fmt"
"os"
"path/filepath"
"git.toowon.com/jimmy/go-common/middleware"
)
// Config 应用配置
@@ -397,20 +395,11 @@ func (c *Config) GetRedis() *RedisConfig {
return c.Redis
}
// GetCORS 获取CORS配置并转换为middleware.CORSConfig
func (c *Config) GetCORS() *middleware.CORSConfig {
if c.CORS == nil {
return middleware.DefaultCORSConfig()
}
return &middleware.CORSConfig{
AllowedOrigins: c.CORS.AllowedOrigins,
AllowedMethods: c.CORS.AllowedMethods,
AllowedHeaders: c.CORS.AllowedHeaders,
ExposedHeaders: c.CORS.ExposedHeaders,
AllowCredentials: c.CORS.AllowCredentials,
MaxAge: c.CORS.MaxAge,
}
// GetCORS 获取CORS配置
// 返回的是 config.CORSConfig需要转换为 middleware.CORSConfig
// 可以使用 middleware.CORSFromConfig() 函数
func (c *Config) GetCORS() *CORSConfig {
return c.CORS
}
// GetMinIO 获取MinIO配置