调整工具类的方法,优化方法调用及增加迁移工具及其用法
This commit is contained in:
@@ -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配置
|
||||
|
||||
Reference in New Issue
Block a user