This commit is contained in:
AJ ONeal 2015-12-21 10:27:57 -07:00
parent bac1dd50af
commit 1c7264538c
2 changed files with 29 additions and 3 deletions

View File

@ -20,6 +20,8 @@ LE.privkeyPath = ':config/live/:hostname/privkey.pem';
LE.fullchainPath = ':config/live/:hostname/fullchain.pem'; LE.fullchainPath = ':config/live/:hostname/fullchain.pem';
LE.certPath = ':config/live/:hostname/cert.pem'; LE.certPath = ':config/live/:hostname/cert.pem';
LE.chainPath = ':config/live/:hostname/chain.pem'; LE.chainPath = ':config/live/:hostname/chain.pem';
LE.renewalPath = ':config/renewal/:hostname.conf';
LE.accountsDir = ':config/accounts/:server';
// backwards compat // backwards compat
LE.stagingServer = leCore.stagingServerUrl; LE.stagingServer = leCore.stagingServerUrl;
@ -213,13 +215,22 @@ LE.create = function (defaults, handlers, backend) {
}, cb); }, cb);
} }
, fetch: function (args, cb) { , fetch: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] fetch');
}
le._fetchHelper(args, cb); le._fetchHelper(args, cb);
} }
, renew: function (args, cb) { , renew: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] renew');
}
args.duplicate = false; args.duplicate = false;
le.register(args, cb); le.register(args, cb);
} }
, getConfig: function (args, cb) { , getConfig: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] getConfig');
}
backend.getConfigAsync(args).then(function (pyobj) { backend.getConfigAsync(args).then(function (pyobj) {
cb(null, le.pyToJson(pyobj)); cb(null, le.pyToJson(pyobj));
}, function (err) { }, function (err) {
@ -228,6 +239,9 @@ LE.create = function (defaults, handlers, backend) {
}); });
} }
, getConfigs: function (args, cb) { , getConfigs: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] getConfigs');
}
backend.getConfigsAsync(args).then(function (configs) { backend.getConfigsAsync(args).then(function (configs) {
cb(null, configs.map(le.pyToJson)); cb(null, configs.map(le.pyToJson));
}, function (err) { }, function (err) {
@ -240,11 +254,17 @@ LE.create = function (defaults, handlers, backend) {
}); });
} }
, setConfig: function (args, cb) { , setConfig: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] setConfig');
}
backend.configureAsync(args).then(function (pyobj) { backend.configureAsync(args).then(function (pyobj) {
cb(null, le.pyToJson(pyobj)); cb(null, le.pyToJson(pyobj));
}); });
} }
, register: function (args, cb) { , register: function (args, cb) {
if (defaults.debug || args.debug) {
console.log('[LE] register');
}
if (!Array.isArray(args.domains)) { if (!Array.isArray(args.domains)) {
cb(new Error('args.domains should be an array of domains')); cb(new Error('args.domains should be an array of domains'));
return; return;

View File

@ -45,6 +45,8 @@ function readRenewalConfig(args) {
} }
function writeRenewalConfig(args) { function writeRenewalConfig(args) {
//console.log('args');
//console.log(args);
var pyobj = args.pyobj; var pyobj = args.pyobj;
pyobj.checkpoints = parseInt(pyobj.checkpoints, 10) || 0; pyobj.checkpoints = parseInt(pyobj.checkpoints, 10) || 0;
@ -433,12 +435,16 @@ module.exports.create = function (defaults, handlers) {
} }
, configureAsync: function (hargs) { , configureAsync: function (hargs) {
hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf'; hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf';
hargs.domains = [];
var copy = merge(hargs, defaults); var copy = merge(hargs, defaults);
tplCopy(copy); 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) { , getConfigAsync: function (hargs) {
hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf'; hargs.renewalPath = hargs.renewalPath || ':config/renewal/:hostname.conf';