Skip to content

Commit 26e1c0d

Browse files
author
奇淼(piexlmax
authored
Revert "[feat]: config for TLS connection in init MySQL (flipped-aurora#1388)" (flipped-aurora#1392)
This reverts commit a4a240e.
1 parent 496bce9 commit 26e1c0d

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

server/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mysql:
6969
max-open-conns: 100
7070
log-mode: ""
7171
log-zap: false
72-
init-tls: false
7372

7473
# pgsql connect configuration
7574
# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master)

server/config/db_list.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type GeneralDB struct {
2222
MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"` // 打开到数据库的最大连接数
2323
LogMode string `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode"` // 是否开启Gorm全局日志
2424
LogZap bool `mapstructure:"log-zap" json:"log-zap" yaml:"log-zap"` // 是否通过zap写入日志文件
25-
InitTls bool `mapstructure:"init-tls" json:"init-tls" yaml:"init-tls"` // 初始化时是否开启TLS
2625
}
2726

2827
type SpecializedDB struct {

server/model/system/request/sys_init.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ type InitDB struct {
1818
// MysqlEmptyDsn msyql 空数据库 建库链接
1919
// Author SliverHorn
2020
func (i *InitDB) MysqlEmptyDsn() string {
21-
initTls := ""
22-
if config.GeneralDB.InitTls {
23-
initTls = "?tls=true"
24-
}
2521
if i.Host == "" {
2622
i.Host = "127.0.0.1"
2723
}
2824
if i.Port == "" {
2925
i.Port = "3306"
3026
}
31-
return fmt.Sprintf("%s:%s@tcp(%s:%s)/"+initTls, i.UserName, i.Password, i.Host, i.Port)
27+
return fmt.Sprintf("%s:%s@tcp(%s:%s)/", i.UserName, i.Password, i.Host, i.Port)
3228
}
3329

3430
// PgsqlEmptyDsn pgsql 空数据库 建库链接
@@ -46,10 +42,6 @@ func (i *InitDB) PgsqlEmptyDsn() string {
4642
// ToMysqlConfig 转换 config.Mysql
4743
// Author [SliverHorn](https://github.com/SliverHorn)
4844
func (i *InitDB) ToMysqlConfig() config.Mysql {
49-
initTls := ""
50-
if config.GeneralDB.InitTls {
51-
initTls = "&tls=true"
52-
}
5345
return config.Mysql{
5446
GeneralDB: config.GeneralDB{
5547
Path: i.Host,
@@ -60,7 +52,7 @@ func (i *InitDB) ToMysqlConfig() config.Mysql {
6052
MaxIdleConns: 10,
6153
MaxOpenConns: 100,
6254
LogMode: "error",
63-
Config: "charset=utf8mb4&parseTime=True&loc=Local" + initTls,
55+
Config: "charset=utf8mb4&parseTime=True&loc=Local",
6456
},
6557
}
6658
}

0 commit comments

Comments
 (0)