diff --git a/index.js b/index.js index f70a7de..b04dbc9 100644 --- a/index.js +++ b/index.js @@ -280,13 +280,17 @@ module.exports.create = function (configs) { var bundleArchive = path.join(archiveDir, 'bundle' + checkpoints + '.pem'); return mkdirpAsync(archiveDir).then(function () { - return PromiseA.all([ + var ps = [ sfs.writeFileAsync(certArchive, pems.cert, 'ascii') , sfs.writeFileAsync(chainArchive, pems.chain, 'ascii') , sfs.writeFileAsync(fullchainArchive, [ pems.cert, pems.chain ].join('\n'), 'ascii') , sfs.writeFileAsync(privkeyArchive, pems.privkey, 'ascii') - , sfs.writeFileAsync(bundleArchive, pems.bundle, 'ascii') - ]); + ]; + if (pems.bundle) { + var bundleP = sfs.writeFileAsync(bundleArchive, pems.bundle, 'ascii'); + ps.push(bundleP); + } + return PromiseA.all(ps); }).then(function () { return mkdirpAsync(liveDir); }).then(function () {