From 9949795533d2a83d7c63367a1297b7b2626d1e7e Mon Sep 17 00:00:00 2001 From: LaysDragon Date: Tue, 28 Nov 2017 21:23:50 +0800 Subject: [PATCH 1/3] fixed sslcapath bug --- lib/config/defaultSSL.js | 2 +- lib/config/index.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/config/defaultSSL.js b/lib/config/defaultSSL.js index 1f1d559..362c62a 100644 --- a/lib/config/defaultSSL.js +++ b/lib/config/defaultSSL.js @@ -12,6 +12,6 @@ function getFile (path) { module.exports = { sslkeypath: getFile('/run/secrets/key.pem'), sslcertpath: getFile('/run/secrets/cert.pem'), - sslcapath: getFile('/run/secrets/ca.pem'), + sslcapath: getFile('/run/secrets/ca.pem') !== undefined ? [getFile('/run/secrets/ca.pem')] : [], dhparampath: getFile('/run/secrets/dhparam.pem') } diff --git a/lib/config/index.js b/lib/config/index.js index addd8ba..6ed652a 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -95,7 +95,15 @@ config.isLDAPEnable = config.ldap.url config.isPDFExportEnable = config.allowpdfexport // generate correct path -config.sslcapath = path.join(appRootPath, config.sslcapath) +config.sslcapath = (function () { + var i, len, results + results = [] + for (i = 0, len = config.sslcapath.length; i < len; i++) { + results.push(path.resolve(appRootPath, config.sslcapath[i])) + } + return results +})() + config.sslcertpath = path.join(appRootPath, config.sslcertpath) config.sslkeypath = path.join(appRootPath, config.sslkeypath) config.dhparampath = path.join(appRootPath, config.dhparampath) From fc626a672410d8990eefb748f59d3a5ab5027c2d Mon Sep 17 00:00:00 2001 From: "Christoph (Sheogorath) Kern" Date: Fri, 22 Dec 2017 12:19:19 +0100 Subject: [PATCH 2/3] Simplify loop --- lib/config/index.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/config/index.js b/lib/config/index.js index 6ed652a..eb59db0 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -95,14 +95,9 @@ config.isLDAPEnable = config.ldap.url config.isPDFExportEnable = config.allowpdfexport // generate correct path -config.sslcapath = (function () { - var i, len, results - results = [] - for (i = 0, len = config.sslcapath.length; i < len; i++) { - results.push(path.resolve(appRootPath, config.sslcapath[i])) - } - return results -})() +config.sslcapath.forEach(function (capath, i, array) { + array[i] = path.resolve(appRootPath, capath) +}) config.sslcertpath = path.join(appRootPath, config.sslcertpath) config.sslkeypath = path.join(appRootPath, config.sslkeypath) From 45976a8916ff2da60bdfb98841f7394fd2659ae7 Mon Sep 17 00:00:00 2001 From: "Christoph (Sheogorath) Kern" Date: Fri, 22 Dec 2017 12:25:13 +0100 Subject: [PATCH 3/3] Update index.js --- lib/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/index.js b/lib/config/index.js index eb59db0..cf6f2ad 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -96,7 +96,7 @@ config.isPDFExportEnable = config.allowpdfexport // generate correct path config.sslcapath.forEach(function (capath, i, array) { - array[i] = path.resolve(appRootPath, capath) + array[i] = path.resolve(appRootPath, capath) }) config.sslcertpath = path.join(appRootPath, config.sslcertpath)