Skip to content

Commit

Permalink
fix: db inline CA cert reconstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Apr 21, 2020
1 parent 81732da commit 02816b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/core/db.js
Expand Up @@ -62,11 +62,16 @@ module.exports = {
}

// Handle inline SSL CA Certificate mode
if (!_.isEmpty(process.env.DB_SSL_CA) && process.env.DB_SSL_CA) {
if (!_.isEmpty(process.env.DB_SSL_CA)) {
const chunks = []
for (let i = 0, charsLength = process.env.DB_SSL_CA.length; i < charsLength; i += 64) {
chunks.push(process.env.DB_SSL_CA.substring(i, i + 64))
}

dbUseSSL = true
sslOptions = {
rejectUnauthorized: true,
ca: process.env.DB_SSL_CA
ca: '-----BEGIN CERTIFICATE-----\n' + chunks.join('\n') + '\n-----END CERTIFICATE-----\n'
}
}

Expand Down

0 comments on commit 02816b6

Please sign in to comment.