perf: 支持连接开启ssl且自签证书的Redis/MongoDB (#2039)

* perf: 支持连接开启ssl且自签证书的Redis/MongoDB

* 修改字段文案

* 修改字段名称

* 修改变量名
This commit is contained in:
jiangweidong 2022-09-07 16:09:07 +08:00 committed by GitHub
parent 1fce7561db
commit 7ad86062b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 3 deletions

View File

@ -267,6 +267,11 @@
"IPLoginLimit": "IP login limit",
"Setting": "Setting",
"Certificate": "Certificate",
"CACertificate": "CA Certificate",
"ClientCertificate": "Client certificate",
"CertificateKey": "Certificate key file",
"AllowInvalidCert": "Allow invalid cert",
"UseSSL": "Use SSL/TLS",
"SecretKey": "Secret key",
"Scope": "Type",
"Builtin": "Builtin",

View File

@ -272,6 +272,11 @@
"IPLoginLimit": "IPログイン制限",
"Setting": "設定",
"Certificate": "証明書",
"CACertificate": "CA 証明書",
"ClientCertificate": "クライアント証明書",
"CertificateKey": "証明書秘密鍵ファイル",
"AllowInvalidCert": "証明書チェックを無視する",
"UseSSL": "使う SSL/TLS",
"SecretKey": "鍵",
"Scope": "カテゴリ",
"Builtin": "内蔵",

View File

@ -272,6 +272,11 @@
"IPLoginLimit": "IP 登录限制",
"Setting": "设置",
"Certificate": "证书",
"CACertificate": "CA 证书",
"ClientCertificate": "客户端证书",
"CertificateKey": "证书秘钥文件",
"AllowInvalidCert": "忽略证书检查",
"UseSSL": "使用 SSL/TLS",
"SecretKey": "密钥",
"Scope": "类别",
"Builtin": "内置",

View File

@ -39,10 +39,25 @@ export default {
type: 'input'
},
use_ssl: {
label: this.$t('common.UseSSL'),
component: 'el-switch'
},
allow_invalid_cert: {
label: this.$t('common.AllowInvalidCert'),
hidden: (form) => { return !form.use_ssl }
},
ca_cert: {
label: this.$t('common.Certificate'),
label: this.$t('common.CACertificate'),
hidden: (form) => { return !form.use_ssl },
component: UploadKey
},
client_cert: {
label: this.$t('common.ClientCertificate'),
hidden: (form) => { return !form.use_ssl },
component: UploadKey
},
cert_key: {
label: this.$t('common.CertificateKey'),
hidden: (form) => { return !form.use_ssl },
component: UploadKey
}

View File

@ -2,12 +2,14 @@ import { ORACLE, MONGODB, REDIS } from '../const'
export function getDatabaseTypeFieldsMap(type) {
const baseParams = ['host', 'port', 'database']
const tlsParams = ['use_ssl', 'allow_invalid_cert', 'ca_cert']
switch (type) {
case ORACLE:
return baseParams.concat(['version'])
case MONGODB:
case REDIS:
return baseParams.concat(['use_ssl', 'ca_cert'])
return baseParams.concat(tlsParams.concat(['client_cert', 'cert_key']))
case MONGODB:
return baseParams.concat(tlsParams.concat(['cert_key']))
default:
return baseParams
}