@sofie-automation/server-core-integration
Version:
Library for connecting to Core
30 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadCertificatesFromDisk = void 0;
// eslint-disable-next-line node/no-extraneous-import
const fs = require("fs");
function loadCertificatesFromDisk(logger, certConfig) {
if (certConfig.unsafeSSL) {
logger.info('Disabling NODE_TLS_REJECT_UNAUTHORIZED, be sure to ONLY DO THIS ON A LOCAL NETWORK!');
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
}
else {
// var rootCas = SSLRootCAs.create()
}
const certificates = [];
if (certConfig.certificates.length) {
logger.info(`Loading certificates...`);
for (const certificate of certConfig.certificates) {
try {
certificates.push(fs.readFileSync(certificate));
logger.info(`Using certificate "${certificate}"`);
}
catch (error) {
logger.error(`Error loading certificate "${certificate}"`, error);
}
}
}
return certificates;
}
exports.loadCertificatesFromDisk = loadCertificatesFromDisk;
//# sourceMappingURL=process.js.map