From 0b9f47dd8459a62e4fd4e9f53961f8413b35eedd Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 10 Sep 2024 15:27:01 +0800 Subject: [PATCH] feat: Postgresql support ssl --- .../DatabaseCreateUpdate.vue | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue b/src/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue index 28a15eed4..fbed21d7a 100644 --- a/src/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue +++ b/src/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue @@ -25,17 +25,17 @@ export default { const platform = this.$route.query.type const baseFields = [[this.$t('Basic'), ['db_name']]] let tlsFields = ['use_ssl', 'ca_cert'] - switch (platform) { - case 'redis': - tlsFields = tlsFields.concat(['client_cert', 'client_key']) - break - case 'mysql': - tlsFields = tlsFields.concat(['client_cert', 'client_key', 'allow_invalid_cert']) - break - case 'mongodb': - tlsFields = tlsFields.concat(['client_key', 'allow_invalid_cert']) - break + const platformFieldsMap = { + redis: ['client_cert', 'client_key'], + postgresql: ['client_cert', 'client_key', 'allow_invalid_cert'], + mysql: ['client_cert', 'client_key', 'allow_invalid_cert'], + mongodb: ['client_key', 'allow_invalid_cert'] } + + if (platformFieldsMap[platform]) { + tlsFields = tlsFields.concat(platformFieldsMap[platform]) + } + if (tlsFields.length > 2) { const secureField = [ this.$t('Secure'), tlsFields, 2