Browse Source

minor updates

wip
AJ ONeal 5 years ago
parent
commit
e2ec6737c6
  1. 10
      certificates.js
  2. 25
      greenlock.js

10
certificates.js

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

25
greenlock.js

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

Loading…
Cancel
Save