2014-07-16 17:57:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-10-20 18:28:59 +00:00
|
|
|
var fs = require('fs');
|
|
|
|
var path = require('path');
|
|
|
|
var generate = require('./ca-store-generator').generate;
|
|
|
|
var latestFile = path.join(__dirname, 'ssl-root-cas-latest.js');
|
2014-07-16 17:57:51 +00:00
|
|
|
|
|
|
|
if (!fs.existsSync(latestFile)) {
|
2014-07-29 14:25:12 +00:00
|
|
|
console.log('Needs latest SSL Root Certificate Authority data', latestFile);
|
2014-07-16 17:57:51 +00:00
|
|
|
module.exports = require('./ssl-root-cas');
|
|
|
|
generate(latestFile).then(function () {
|
|
|
|
console.info('\n');
|
|
|
|
console.info('##########################################################################################');
|
|
|
|
console.info('# #');
|
|
|
|
console.info('# Downloaded the latest Root Certificate Authorities. Restart your server to use them. #');
|
|
|
|
console.info('# #');
|
|
|
|
console.info('##########################################################################################');
|
|
|
|
console.info('\n');
|
|
|
|
}, function (e) {
|
|
|
|
console.warn('\n\n');
|
|
|
|
console.warn("Couldn't download the latest Root CAs, but it's not a big deal.");
|
|
|
|
console.warn('');
|
|
|
|
console.warn('Use "require(\'ssl-root-cas\')" instead of "require(\'ssl-root-cas/latest\')"');
|
|
|
|
console.warn('');
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
module.exports = require('./ssl-root-cas-latest');
|
|
|
|
}
|