From b9cdd82719b23548a7b84e59c99f6829f2b213d9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 25 Apr 2014 16:31:57 -0500 Subject: [PATCH] added convenience method `addFile` --- ca-store-generator.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ca-store-generator.js b/ca-store-generator.js index c2fb49b..085d998 100644 --- a/ca-store-generator.js +++ b/ca-store-generator.js @@ -133,6 +133,11 @@ function dumpCerts(certs) { + " if (!opts.ca || !opts.ca.__injected) { opts.ca = (opts.ca||[]).concat(cas); }\n" + " opts.ca.__injected = true;\n" + "};\n" + + "module.exports.addFile = function (filepath) {\n" + + " var opts = require('https').globalAgent.options;\n" + + " opts.ca = opts.ca || [];\n" + + " opts.ca.push(require('fs').readFileSync(require('path').join.apply(null, filepath.split(/\//g))));\n" + + "};\n" ); console.info("Wrote '" + OUTFILE.replace(/'/g, "\\'") + "'."); }