From 7ef653370fb4742dfa52f4535512c787f96e9920 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 15 Apr 2023 18:02:16 +0800 Subject: [PATCH] fix: ssl connection with file path is not handled correctly --- .../src/utils/common/NcConnectionMgr.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/nocodb-nest/src/utils/common/NcConnectionMgr.ts b/packages/nocodb-nest/src/utils/common/NcConnectionMgr.ts index 4f543cdbda..22f1101ffe 100644 --- a/packages/nocodb-nest/src/utils/common/NcConnectionMgr.ts +++ b/packages/nocodb-nest/src/utils/common/NcConnectionMgr.ts @@ -73,25 +73,34 @@ export default class NcConnectionMgr { connectionConfig.connection.ssl.caFilePath && !connectionConfig.connection.ssl.ca ) { - connectionConfig.connection.ssl.ca = await promisify(fs.readFile)( - connectionConfig.connection.ssl.caFilePath, + connectionConfig.connection.ssl.ca = ( + await promisify(fs.readFile)( + connectionConfig.connection.ssl.caFilePath, + ) ).toString(); + delete connectionConfig.connection.ssl.caFilePath; } if ( connectionConfig.connection.ssl.keyFilePath && !connectionConfig.connection.ssl.key ) { - connectionConfig.connection.ssl.key = await promisify(fs.readFile)( - connectionConfig.connection.ssl.keyFilePath, + connectionConfig.connection.ssl.key = ( + await promisify(fs.readFile)( + connectionConfig.connection.ssl.keyFilePath, + ) ).toString(); + delete connectionConfig.connection.ssl.keyFilePath; } if ( connectionConfig.connection.ssl.certFilePath && !connectionConfig.connection.ssl.cert ) { - connectionConfig.connection.ssl.cert = await promisify(fs.readFile)( - connectionConfig.connection.ssl.certFilePath, + connectionConfig.connection.ssl.cert = ( + await promisify(fs.readFile)( + connectionConfig.connection.ssl.certFilePath, + ) ).toString(); + delete connectionConfig.connection.ssl.certFilePath; } }