From 3302ccf3352649e9635ba7d33be6164b084b8f25 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 9 May 2019 00:28:08 -0600 Subject: [PATCH] bugfix: options.certificate is optional --- greenlock-store-sequelize.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/greenlock-store-sequelize.js b/greenlock-store-sequelize.js index 1e80a68..2edd794 100644 --- a/greenlock-store-sequelize.js +++ b/greenlock-store-sequelize.js @@ -17,7 +17,7 @@ module.exports.create = function (config={}) { else { // This library expects config.db to resolve the db object. We'll ensure // that this is the case with the provided db, as it was with the baked-in - // db. + // db. config.db = Promise.resolve(config.db); } @@ -108,7 +108,7 @@ module.exports.create = function (config={}) { return db.Keypair.findOne({ where: { // using xid because id is reserved by sequelize - xid: opts.certificate.kid || opts.certificate.id || opts.subject + xid: (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject } }); }).then(function (record) { @@ -131,7 +131,7 @@ module.exports.create = function (config={}) { return db.Keypair.findOrCreate({ where: { // using xid because id is reserved by sequelize - xid: opts.certificate.kid || opts.certificate.id || opts.subject + xid: (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject } }); }).then(function ([record,created]) {