debugging, fix callback -> promise

This commit is contained in:
AJ ONeal 2015-12-19 22:26:12 +00:00
parent 806a80e3e5
commit 3a1f66f9e2
1 changed files with 12 additions and 3 deletions

View File

@ -35,8 +35,13 @@ function getAcmeUrls(args) {
function getCertificateAsync(account, args, defaults, handlers) { function getCertificateAsync(account, args, defaults, handlers) {
return leCrypto.generateRsaKeypairAsync(args.rsaKeySize, args.rsaExponent).then(function (domainKey) { return leCrypto.generateRsaKeypairAsync(args.rsaKeySize, args.rsaExponent).then(function (domainKey) {
if (args.debug) {
console.log("get certificate");
}
return LeCore.getCertificateAsync({ return LeCore.getCertificateAsync({
newAuthzUrl: args._acmeUrls.newAuthz debug: args.debug
, newAuthzUrl: args._acmeUrls.newAuthz
, newCertUrl: args._acmeUrls.newCert , newCertUrl: args._acmeUrls.newCert
, accountPrivateKeyPem: account.privateKeyPem , accountPrivateKeyPem: account.privateKeyPem
@ -82,11 +87,15 @@ function getCertificateAsync(account, args, defaults, handlers) {
} }
} }
}).then(function (result) { }).then(function (result) {
if (args.debug) {
console.log("got certificate!");
}
result.fullchain = result.cert + '\n' + result.ca; result.fullchain = result.cert + '\n' + result.ca;
var pyconf = PromiseA.promisifyAll(require('pyconf')); var pyconf = PromiseA.promisifyAll(require('pyconf'));
return pyconf.readFileAsync(args.renewalPath, function (obj) { return pyconf.readFileAsync(args.renewalPath).then(function (obj) {
return obj; return obj;
}, function () { }, function () {
return pyconf.readFileAsync(path.join(__dirname, 'lib', 'renewal.conf.tpl')).then(function (obj) { return pyconf.readFileAsync(path.join(__dirname, 'lib', 'renewal.conf.tpl')).then(function (obj) {
@ -204,7 +213,7 @@ function registerWithAcme(args, defaults, handlers) {
args.renewalPath = args.renewalPath || path.join(configDir, 'renewal', args.domains[0] + '.conf'); args.renewalPath = args.renewalPath || path.join(configDir, 'renewal', args.domains[0] + '.conf');
args.accountsDir = args.accountsDir || path.join(configDir, 'accounts', acmeHostname, 'directory'); args.accountsDir = args.accountsDir || path.join(configDir, 'accounts', acmeHostname, 'directory');
return pyconf.readFileAsync(args.renewalDir).then(function (renewal) { return pyconf.readFileAsync(args.renewalPath).then(function (renewal) {
var accountId = renewal.account; var accountId = renewal.account;
renewal = renewal.account; renewal = renewal.account;