diff options
Diffstat (limited to 'lib/config/load-cafile.js')
-rw-r--r-- | lib/config/load-cafile.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/config/load-cafile.js b/lib/config/load-cafile.js index cc63615ff..1bf9cc490 100644 --- a/lib/config/load-cafile.js +++ b/lib/config/load-cafile.js @@ -1,14 +1,13 @@ module.exports = loadCAFile -var fs = require("fs") +var fs = require('fs') -function loadCAFile(cafilePath, cb) { - if (!cafilePath) - return process.nextTick(cb) +function loadCAFile (cafilePath, cb) { + if (!cafilePath) return process.nextTick(cb) - fs.readFile(cafilePath, "utf8", afterCARead.bind(this)) + fs.readFile(cafilePath, 'utf8', afterCARead.bind(this)) - function afterCARead(er, cadata) { + function afterCARead (er, cadata) { if (er) { // previous cafile no longer exists, so just continue on gracefully @@ -16,19 +15,19 @@ function loadCAFile(cafilePath, cb) { return cb(er) } - var delim = "-----END CERTIFICATE-----" + var delim = '-----END CERTIFICATE-----' var output output = cadata .split(delim) - .filter(function(xs) { + .filter(function (xs) { return !!xs.trim() }) - .map(function(xs) { + .map(function (xs) { return xs.trimLeft() + delim }) - this.set("ca", output) + this.set('ca', output) cb(null) } } |