feat: 新增mysql ssh代理连接方式

This commit is contained in:
大圣之家
2022-07-20 01:37:25 +00:00
committed by Gitee
parent 5271bd21e8
commit 8c9253da80
8 changed files with 150 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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"`
}