mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-04 05:36:35 +08:00
feat: 新增mysql ssh代理连接方式
This commit is contained in:
@@ -55,6 +55,15 @@ func (d *Db) Save(rc *ctx.ReqCtx) {
|
||||
|
||||
// 密码脱敏记录日志
|
||||
form.Password = "****"
|
||||
|
||||
if form.Type == "mysql" && form.EnableSSH == 1 {
|
||||
originSSHPwd, err := utils.DefaultRsaDecrypt(form.SSHPass, true)
|
||||
biz.ErrIsNilAppendErr(err, "解密密码错误: %s")
|
||||
db.SSHPass = originSSHPwd
|
||||
// 密码脱敏记录日志
|
||||
form.SSHPass = "****"
|
||||
}
|
||||
|
||||
rc.ReqParam = form
|
||||
|
||||
db.SetBaseInfo(rc.LoginAccount)
|
||||
|
||||
@@ -14,6 +14,12 @@ type DbForm struct {
|
||||
Project string `json:"project"`
|
||||
Env string `json:"env"`
|
||||
EnvId uint64 `binding:"required" json:"envId"`
|
||||
|
||||
EnableSSH int `json:"enable_ssh"`
|
||||
SSHHost string `json:"ssh_host"`
|
||||
SSHPort int `json:"ssh_port"`
|
||||
SSHUser string `json:"ssh_user"`
|
||||
SSHPass string `json:"ssh_pass"`
|
||||
}
|
||||
|
||||
type DbSqlSaveForm struct {
|
||||
|
||||
@@ -19,4 +19,9 @@ type SelectDataDbVO struct {
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
Creator *string `json:"creator"`
|
||||
CreatorId *int64 `json:"creatorId"`
|
||||
|
||||
EnableSSH *int `json:"enable_ssh"`
|
||||
SSHHost *string `json:"ssh_host"`
|
||||
SSHPort *int `json:"ssh_port"`
|
||||
SSHUser *string `json:"ssh_user"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user