|
|
@ -176,12 +176,18 @@ function getCertificateAsync(account, args, defaults, handlers) { |
|
|
|
, sfs.writeFileAsync(chainPath, result.chain, 'ascii') |
|
|
|
, sfs.writeFileAsync(fullchainPath, result.fullchain, 'ascii') |
|
|
|
, sfs.writeFileAsync(privkeyPath, result.key, 'ascii') |
|
|
|
]); |
|
|
|
]).then(function () { |
|
|
|
// TODO format result licesy
|
|
|
|
//console.log(liveDir);
|
|
|
|
//console.log(result);
|
|
|
|
return { |
|
|
|
certPath: certPath |
|
|
|
, chainPath: chainPath |
|
|
|
, fullchainPath: fullchainPath |
|
|
|
, privkeyPath: privkeyPath |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(liveDir); |
|
|
|
console.log(result); |
|
|
|
throw new Error("IMPLEMENTATION NOT COMPLETE"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
@ -193,8 +199,6 @@ function registerWithAcme(args, defaults, handlers) { |
|
|
|
var configDir = args.configDir || defaults.configDir || LE.configDir; |
|
|
|
|
|
|
|
args.server = server; |
|
|
|
console.log('args.server'); |
|
|
|
console.log(server); |
|
|
|
args.renewalDir = args.renewalDir || path.join(configDir, 'renewal', args.domains[0] + '.conf'); |
|
|
|
args.accountsDir = args.accountsDir || path.join(configDir, 'accounts', acmeHostname, 'directory'); |
|
|
|
|
|
|
@ -228,14 +232,14 @@ function registerWithAcme(args, defaults, handlers) { |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
console.log(account); |
|
|
|
//console.log(account);
|
|
|
|
return fetchFromConfigLiveDir(args, defaults).then(function (certs) { |
|
|
|
// if nothing, register and save
|
|
|
|
// if something, check date (don't register unless 30+ days)
|
|
|
|
// if good, don't bother registering
|
|
|
|
// (but if we get to the point that we're actually calling
|
|
|
|
// this function, that shouldn't be the case, right?)
|
|
|
|
console.log(certs); |
|
|
|
//console.log(certs);
|
|
|
|
if (!certs) { |
|
|
|
// no certs, seems like a good time to get some
|
|
|
|
return getCertificateAsync(account, args, defaults, handlers); |
|
|
@ -244,12 +248,12 @@ function registerWithAcme(args, defaults, handlers) { |
|
|
|
// cert is at least 27 days old we can renew that
|
|
|
|
return getCertificateAsync(account, args, defaults, handlers); |
|
|
|
} |
|
|
|
else if (args.force) { |
|
|
|
else if (args.duplicate) { |
|
|
|
// YOLO! I be gettin' fresh certs 'erday! Yo!
|
|
|
|
return getCertificateAsync(account, args, defaults, handlers); |
|
|
|
} |
|
|
|
else { |
|
|
|
console.warn('[WARN] Ignoring renewal attempt for certificate less than 27 days old. Use args.force to force.'); |
|
|
|
console.warn('[WARN] Ignoring renewal attempt for certificate less than 27 days old. Use args.duplicate to force.'); |
|
|
|
// We're happy with what we have
|
|
|
|
return certs; |
|
|
|
} |
|
|
|