From 59a04a15863fdda761881a02898654d70f1b2af4 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 30 Oct 2019 08:08:40 +0000 Subject: [PATCH] v3.0.11: reduce scope of manager.find() --- greenlock.js | 23 ++++++++++++++++++++--- package-lock.json | 8 ++++---- package.json | 4 ++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/greenlock.js b/greenlock.js index ee84fc7..d8f11aa 100644 --- a/greenlock.js +++ b/greenlock.js @@ -230,7 +230,7 @@ G.create = function(gconf) { greenlock._single = function(args) { if ('string' !== typeof args.servername) { - return Promise.reject(new Error('no servername given')); + return Promise.reject(new Error('no `servername` given')); } // www.example.com => *.example.com args.wildname = @@ -297,11 +297,28 @@ G.create = function(gconf) { }); }; + greenlock._find = function(args) { + var altnames = args.altnames || []; + + // servername, wildname, and altnames are all the same + ['wildname', 'servername'].forEach(function(k) { + var altname = args[k]; + if (altname && !altnames.includes(altname)) { + altnames.push(altname); + } + }); + if (altnames.length) { + args.altnames = altnames; + } + + return greenlock.manager.find(args); + }; + greenlock._config = function(args) { return greenlock ._single(args) .then(function() { - return greenlock.manager.find(args); + return greenlock._find(args); }) .then(function(sites) { if (!sites || !sites.length) { @@ -351,7 +368,7 @@ G.create = function(gconf) { } //console.log('greenlock._renew find', args); - return greenlock.manager.find(args).then(function(sites) { + return greenlock._find(args).then(function(sites) { // Note: the manager must guaranteed that these are mutable copies //console.log('greenlock._renew found', sites); diff --git a/package-lock.json b/package-lock.json index 054c995..5887966 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@root/greenlock", - "version": "3.0.10", + "version": "3.0.11", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -90,9 +90,9 @@ "dev": true }, "greenlock-manager-fs": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/greenlock-manager-fs/-/greenlock-manager-fs-0.6.5.tgz", - "integrity": "sha512-Y/896/4nGM2ockujdzfT+ChLsuTkRp/WkWt/WqdeUxBrgp1qvDha6UUCH3v7nt9U+nqIbk+wz7sFhHPcqR1cDA==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/greenlock-manager-fs/-/greenlock-manager-fs-0.7.0.tgz", + "integrity": "sha512-cWmrfdSbT0ettDZzl6SXhZ47gVLj7saM/tdEP6sEfnsocJ3mRFRP3QUrJYyLVdCOCuVH6cclOKLembIrZjwDrQ==", "requires": { "@root/mkdirp": "^1.0.0", "safe-replace": "^1.1.0" diff --git a/package.json b/package.json index 5250bdd..3fd6ed1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@root/greenlock", - "version": "3.0.10", + "version": "3.0.11", "description": "The easiest Let's Encrypt client for Node.js and Browsers", "homepage": "https://rootprojects.org/greenlock/", "main": "greenlock.js", @@ -42,7 +42,7 @@ "@root/request": "^1.3.10", "acme-http-01-standalone": "^3.0.5", "cert-info": "^1.5.1", - "greenlock-manager-fs": "^0.6.5", + "greenlock-manager-fs": "^0.7.0", "greenlock-store-fs": "^3.2.0", "safe-replace": "^1.1.0" },