perf: support redis url with `rediss` protocol #127
This commit is contained in:
parent
581a1b79ca
commit
f94134faa0
|
@ -528,21 +528,27 @@ func (c *connectionService) ParseConnectURL(url string) (resp types.JSResp) {
|
|||
if len(addrPart) > 1 {
|
||||
port, _ = strconv.Atoi(addrPart[1])
|
||||
}
|
||||
var sslServerName string
|
||||
if urlOpt.TLSConfig != nil {
|
||||
sslServerName = urlOpt.TLSConfig.ServerName
|
||||
}
|
||||
resp.Success = true
|
||||
resp.Data = struct {
|
||||
Addr string `json:"addr"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
ConnTimeout int64 `json:"connTimeout"`
|
||||
ExecTimeout int64 `json:"execTimeout"`
|
||||
Addr string `json:"addr"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
ConnTimeout int64 `json:"connTimeout"`
|
||||
ExecTimeout int64 `json:"execTimeout"`
|
||||
SSLServerName string `json:"sslServerName,omitempty"`
|
||||
}{
|
||||
Addr: addr,
|
||||
Port: port,
|
||||
Username: urlOpt.Username,
|
||||
Password: urlOpt.Password,
|
||||
ConnTimeout: int64(urlOpt.DialTimeout.Seconds()),
|
||||
ExecTimeout: int64(urlOpt.ReadTimeout.Seconds()),
|
||||
Addr: addr,
|
||||
Port: port,
|
||||
Username: urlOpt.Username,
|
||||
Password: urlOpt.Password,
|
||||
ConnTimeout: int64(urlOpt.DialTimeout.Seconds()),
|
||||
ExecTimeout: int64(urlOpt.ReadTimeout.Seconds()),
|
||||
SSLServerName: sslServerName,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ const onClose = () => {
|
|||
|
||||
const pasteFromClipboard = async () => {
|
||||
// url example:
|
||||
// redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
|
||||
// rediss://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
|
||||
let opt = {}
|
||||
try {
|
||||
opt = await connectionStore.parseUrlFromClipboard()
|
||||
|
@ -288,6 +288,13 @@ const pasteFromClipboard = async () => {
|
|||
if (opt.execTimeout > 0) {
|
||||
generalForm.value.execTimeout = opt.execTimeout
|
||||
}
|
||||
const { sslServerName = null } = opt
|
||||
if (sslServerName != null) {
|
||||
generalForm.value.ssl.enable = true
|
||||
if (!isEmpty(sslServerName)) {
|
||||
generalForm.value.ssl.sni = sslServerName
|
||||
}
|
||||
}
|
||||
$message.success(i18n.t('dialogue.connection.parse_pass', { url: opt.url }))
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue