bugfix: options.certificate is optional
This commit is contained in:
		
						commit
						b4c490f8a0
					
				@ -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]) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user