feat: add TLS configuration option for MySQL (#384)

This commit is contained in:
Tom authored and GitHub committed 2025-09-03 19:43:16 +08:00
1 parent faee954f6d
commit ce0291a8f9
6 files changed
+7 -2

No files matched your search

+2 -1
View File
@@ -145,11 +145,12 @@ func InitGlobal() {
//gorm
if global.Config.Gorm.Type == config.TypeMysql {
dsn := fmt.Sprintf("%s:%s@(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
dsn := fmt.Sprintf("%s:%s@(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local&tls=%s",
global.Config.Mysql.Username,
global.Config.Mysql.Password,
global.Config.Mysql.Addr,
global.Config.Mysql.Dbname,
global.Config.Mysql.Tls,
)
global.DB = orm.NewMysql(&orm.MysqlConfig{