diff --git a/index.js b/index.js index 4c33c49..9f55658 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,8 @@ LE.privkeyPath = ':config/live/:hostname/privkey.pem'; LE.fullchainPath = ':config/live/:hostname/fullchain.pem'; LE.certPath = ':config/live/:hostname/cert.pem'; LE.chainPath = ':config/live/:hostname/chain.pem'; +LE.renewalPath = ':config/renewal/:hostname.conf'; +LE.accountsDir = ':config/accounts/:server'; // backwards compat LE.stagingServer = leCore.stagingServerUrl; @@ -213,13 +215,22 @@ LE.create = function (defaults, handlers, backend) { }, cb); } , fetch: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] fetch'); + } le._fetchHelper(args, cb); } , renew: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] renew'); + } args.duplicate = false; le.register(args, cb); } , getConfig: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] getConfig'); + } backend.getConfigAsync(args).then(function (pyobj) { cb(null, le.pyToJson(pyobj)); }, function (err) { @@ -228,6 +239,9 @@ LE.create = function (defaults, handlers, backend) { }); } , getConfigs: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] getConfigs'); + } backend.getConfigsAsync(args).then(function (configs) { cb(null, configs.map(le.pyToJson)); }, function (err) { @@ -240,11 +254,17 @@ LE.create = function (defaults, handlers, backend) { }); } , setConfig: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] setConfig'); + } backend.configureAsync(args).then(function (pyobj) { cb(null, le.pyToJson(pyobj)); }); } , register: function (args, cb) { + if (defaults.debug || args.debug) { + console.log('[LE] register'); + } if (!Array.isArray(args.domains)) { cb(new Error('args.domains should be an array of domains')); return; diff --git a/lib/core.js b/lib/core.js index 097e408..ea61351 100644 --- a/lib/core.js +++ b/lib/core.js @@ -45,6 +45,8 @@ function readRenewalConfig(args) { } function writeRenewalConfig(args) { + //console.log('args'); + //console.log(args); var pyobj = args.pyobj; pyobj.checkpoints = parseInt(pyobj.checkpoints, 10) || 0; @@ -433,12 +435,16 @@ module.exports.create = function (defaults, handlers) { } , configureAsync: function (hargs) { hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf'; - hargs.domains = []; - var copy = merge(hargs, defaults); tplCopy(copy); - return getOrCreateRenewal(copy); + //console.log('[LE] configureAsync copy'); + //console.log(hargs); + //console.log(copy); + return getOrCreateAcmeAccount(copy, defaults, handlers).then(function (account) { + copy.account = account; + return getOrCreateRenewal(copy); + }); } , getConfigAsync: function (hargs) { hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf';