From 2d6c278c9387e22d05e48c2f3400567f8ec37cf4 Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Wed, 22 Aug 2018 23:07:18 +0200 Subject: [PATCH] Changed inner certificates mapping to a clearer implementation --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6e6a225..65fff33 100644 --- a/index.js +++ b/index.js @@ -592,8 +592,13 @@ class Pass { let certPaths = Object.keys(options.certificates) .filter(v => v !== "dir") - .map((val) => readFile(path.resolve(typeof options.certificates[val] !== "object" ? options.certificates[val] : options.certificates[val]["keyFile"]))); + .map((val) => { + const cert = options.certificates[val]; + const filePath = !(cert instanceof Object) ? cert : cert["keyFile"]; + const resolvedPath = path.resolve(filePath); + return readFile(resolvedPath); + }); return Promise.all(certPaths).then(contents => { contents.forEach(file => {