From 8f6aa1cc8ce2ddc37099a1ceabbcc3901410d9fb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 5 Nov 2018 00:14:22 -0700 Subject: [PATCH] update examples --- README.md | 8 +++----- examples/production.js | 17 ++++++++--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 05a0d14..f6ae56e 100644 --- a/README.md +++ b/README.md @@ -380,12 +380,10 @@ function approveDomains(opts, certs, cb) { // The domains being approved for the first time are listed in opts.domains // Certs being renewed are listed in certs.altnames if (certs) { - opts.domains = certs.altnames; - } - else { - opts.email = 'john.doe@example.com'; - opts.agreeTos = true; + opts.domains = [certs.subject].concat(certs.altnames); } + opts.email = 'john.doe@example.com'; + opts.agreeTos = true; // NOTE: you can also change other options such as `challengeType` and `challenge` // opts.challengeType = 'http-01'; diff --git a/examples/production.js b/examples/production.js index f49db1b..08ee7ef 100644 --- a/examples/production.js +++ b/examples/production.js @@ -40,23 +40,22 @@ var server = greenlock.listen(80, 443); // function approveDomains(opts, certs, cb) { - // The domains being approved for the first time are listed in opts.domains - // Certs being renewed are listed in certs.altnames - if (certs) { - opts.domains = certs.altnames; - cb(null, { options: opts, certs: certs }); - return; - } - // Only one domain is listed with *automatic* registration via SNI // (it's an array because managed registration allows for multiple domains, // which was the case in the simple example) console.log(opts.domains); + // The domains being approved for the first time are listed in opts.domains + // Certs being renewed are listed in certs.altnames + if (certs) { + opts.domains = [certs.subject].concat(certs.altnames); + } + fooCheckDb(opts.domains, function (err, agree, email) { if (err) { cb(err); return; } - // You MUST NOT build clients that accept the ToS without asking the user + // Services SHOULD automatically accept the ToS and use YOUR email + // Clients MUST NOT accept the ToS without asking the user opts.agreeTos = agree; opts.email = email;