Browse Source

fix (dbConfig): ssl connection with file path is not handled correctly

pull/5364/head
Kamal Mahmudi 2 years ago
parent
commit
edb4773fe9
  1. 15
      packages/nocodb/src/lib/utils/NcConfigFactory.ts

15
packages/nocodb/src/lib/utils/NcConfigFactory.ts

@ -380,22 +380,25 @@ export default class NcConfigFactory implements NcConfig {
typeof dbConfig?.connection?.ssl === 'object' typeof dbConfig?.connection?.ssl === 'object'
) { ) {
if (dbConfig.connection.ssl.caFilePath && !dbConfig.connection.ssl.ca) { if (dbConfig.connection.ssl.caFilePath && !dbConfig.connection.ssl.ca) {
dbConfig.connection.ssl.ca = await promisify(fs.readFile)( dbConfig.connection.ssl.ca = (await promisify(fs.readFile)(
dbConfig.connection.ssl.caFilePath dbConfig.connection.ssl.caFilePath
).toString(); )).toString();
delete dbConfig.connection.ssl.caFilePath;
} }
if (dbConfig.connection.ssl.keyFilePath && !dbConfig.connection.ssl.key) { if (dbConfig.connection.ssl.keyFilePath && !dbConfig.connection.ssl.key) {
dbConfig.connection.ssl.key = await promisify(fs.readFile)( dbConfig.connection.ssl.key = (await promisify(fs.readFile)(
dbConfig.connection.ssl.keyFilePath dbConfig.connection.ssl.keyFilePath
).toString(); )).toString();
delete dbConfig.connection.ssl.keyFilePath;
} }
if ( if (
dbConfig.connection.ssl.certFilePath && dbConfig.connection.ssl.certFilePath &&
!dbConfig.connection.ssl.cert !dbConfig.connection.ssl.cert
) { ) {
dbConfig.connection.ssl.cert = await promisify(fs.readFile)( dbConfig.connection.ssl.cert = (await promisify(fs.readFile)(
dbConfig.connection.ssl.certFilePath dbConfig.connection.ssl.certFilePath
).toString(); )).toString();
delete dbConfig.connection.ssl.certFilePath;
} }
} }

Loading…
Cancel
Save