bugfix: options.certificate is optional
This commit is contained in:
parent
57ffcf01db
commit
3302ccf335
|
@ -17,7 +17,7 @@ module.exports.create = function (config={}) {
|
||||||
else {
|
else {
|
||||||
// This library expects config.db to resolve the db object. We'll ensure
|
// 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
|
// that this is the case with the provided db, as it was with the baked-in
|
||||||
// db.
|
// db.
|
||||||
config.db = Promise.resolve(config.db);
|
config.db = Promise.resolve(config.db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ module.exports.create = function (config={}) {
|
||||||
return db.Keypair.findOne({
|
return db.Keypair.findOne({
|
||||||
where: {
|
where: {
|
||||||
// using xid because id is reserved by sequelize
|
// 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) {
|
}).then(function (record) {
|
||||||
|
@ -131,7 +131,7 @@ module.exports.create = function (config={}) {
|
||||||
return db.Keypair.findOrCreate({
|
return db.Keypair.findOrCreate({
|
||||||
where: {
|
where: {
|
||||||
// using xid because id is reserved by sequelize
|
// 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]) {
|
}).then(function ([record,created]) {
|
||||||
|
|
Loading…
Reference in New Issue