minor updates

This commit is contained in:
AJ ONeal 2019-10-28 02:25:32 -06:00
parent 7774d0f8b1
commit e2ec6737c6
2 changed files with 24 additions and 11 deletions

View File

@ -152,14 +152,8 @@ C._rawOrder = function(gnlck, mconf, db, acme, chs, acc, email, args) {
return Enc.bufToUrlBase64(csrDer);
})
.then(function(csr) {
function notify() {
gnlck._notify('challenge_status', {
options: args,
subject: args.subject,
altnames: args.altnames,
account: acc,
email: email
});
function notify(ev, opts) {
gnlck._notify(ev, opts);
}
var certReq = {
debug: args.debug || gnlck._defaults.debug,

View File

@ -86,7 +86,6 @@ G.create = function(gconf) {
});
return p;
};
greenlock._init();
// The goal here is to reduce boilerplate, such as error checking
// and duration parsing, that a manager must implement
@ -256,8 +255,16 @@ G.create = function(gconf) {
order.pems = pems;
})
.catch(function(err) {
order.error = err;
greenlock._notify('order_error', order);
// For greenlock express serialization
err.toJSON = errorToJSON;
err.subject = site.subject;
if (args.servername) {
err.servername = args.servername;
}
// for debugging, but not to be relied on
err._order = order;
// TODO err.context = err.context || 'renew_certificate'
greenlock._notify('error', err);
})
.then(function() {
return next();
@ -395,6 +402,10 @@ G._defaults = function(opts) {
defaults[k] = opts[k];
});
if ('function' === typeof opts.notify) {
defaults.notify = opts.notify;
}
if (!defaults._maintainerPackage) {
defaults._maintainerPackage = pkg.name;
defaults._maintainerPackageVersion = pkg.version;
@ -599,3 +610,11 @@ Greenlock._normalizeChallenge = function(name, ch) {
return ch;
};
function errorToJSON(e) {
var error = {};
Object.getOwnPropertyNames(e).forEach(function(k) {
error[k] = e[k];
});
return error;
}