bugfix updates for Greenlock v3

This commit is contained in:
AJ ONeal 2019-10-27 04:32:24 -06:00
parent 6d398d36c4
commit ba284d0004
2 changed files with 14 additions and 11 deletions

View File

@ -19,8 +19,7 @@ var mkdirpAsync = PromiseA.promisify(require('@root/mkdirp'));
certificates.check = function(opts) {
// { certificate.id, subject, ... }
var id = (opts.certificate && opts.certificate.id) || opts.subject;
//console.log('certificates.check for', opts.certificate, opts.subject);
//console.log(opts);
//console.log('certificates.check for', opts);
// For advanced use cases:
// This just goes to show that any options set in approveDomains() will be available here
@ -73,7 +72,7 @@ certificates.check = function(opts) {
// Use certificate.kid, certificate.id, or subject to find a certificate keypair
// Return an object with string privateKeyPem and/or object privateKeyJwk (or null, not undefined)
certificates.checkKeypair = function(opts) {
//console.log('certificates.checkKeypair:', opts.certificate, opts.subject);
//console.log('certificates.checkKeypair:', opts);
return readFileAsync(
U._tameWild(privkeyPath(store, opts), opts.subject),
@ -124,7 +123,7 @@ certificates.setKeypair = function(opts) {
// Use certificate.id (or subject if no ki is present) to save a certificate
// Return null (not undefined) on success, or throw on error
certificates.set = function(opts) {
//console.log('certificates.set:', opts.subject, opts.pems);
//console.log('certificates.set:', opts);
var pems = {
cert: opts.pems.cert, // string PEM the first half of the concatonated fullchain.pem cert
chain: opts.pems.chain, // string PEM the second half (yes, you need this too)
@ -223,13 +222,12 @@ function privkeyPath(store, opts) {
}
function certPath(store, opts) {
var dir = U._tpl(
store,
opts,
var pathname =
opts.certPath ||
store.options.certPath ||
path.join(liveDir(), 'cert.pem')
);
store.options.certPath ||
path.join(liveDir(), 'cert.pem');
var dir = U._tpl(store, opts, pathname);
return U._tameWild(dir, opts.subject || '');
}

View File

@ -22,7 +22,11 @@ U._tpl = function tpl(store, opts, str) {
].forEach(function(group) {
group.forEach(function(tmpl) {
group.forEach(function(key) {
var item = store.options[key] || opts[key] || '';
var item = opts[key] || store.options[key];
if ('string' !== typeof item) {
return;
}
if ('directoryUrl' === key) {
item = item.replace(/^https?:\/\//i, '');
}
@ -35,6 +39,7 @@ U._tpl = function tpl(store, opts, str) {
// item = item;
}
}
if (-1 === str.indexOf(':' + tmpl)) {
return;
}