debugging, fix callback -> promise
This commit is contained in:
parent
806a80e3e5
commit
3a1f66f9e2
15
lib/core.js
15
lib/core.js
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue