From 63e6ff0b229bde8dcc05e9ed78609de40d18343e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 29 Nov 2019 17:25:21 -0700 Subject: [PATCH] set directoryUrl for store --- greenlock.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/greenlock.js b/greenlock.js index ec79a62..077517d 100644 --- a/greenlock.js +++ b/greenlock.js @@ -374,7 +374,7 @@ G.create = function(gconf) { return renewedOrFailed; }; - greenlock._acme = async function(mconf, args) { + greenlock._acme = async function(mconf, args, dirUrl) { var packageAgent = gconf.packageAgent || ''; // because Greenlock_Express/v3.x Greenlock/v3 is redundant if (!/greenlock/i.test(packageAgent)) { @@ -387,11 +387,6 @@ G.create = function(gconf) { debug: greenlock._defaults.debug || args.debug }); - var dirUrl = DIR._getDirectoryUrl( - args.directoryUrl || mconf.directoryUrl, - args.servername - ); - var dir = caches[dirUrl]; // don't cache more than an hour if (dir && Date.now() - dir.ts < 1 * 60 * 60 * 1000) { @@ -420,7 +415,13 @@ G.create = function(gconf) { }; greenlock._order = async function(mconf, siteConf) { // packageAgent, maintainerEmail - var acme = await greenlock._acme(mconf, siteConf); + + var dirUrl = DIR._getDirectoryUrl( + siteConf.directoryUrl || mconf.directoryUrl, + siteConf.subject + ); + + var acme = await greenlock._acme(mconf, siteConf, dirUrl); var storeConf = siteConf.store || mconf.store; storeConf = JSON.parse(JSON.stringify(storeConf)); storeConf.packageRoot = gconf.packageRoot; @@ -433,6 +434,7 @@ G.create = function(gconf) { gconf.packageRoot || process.cwd(), storeConf.basePath ); + storeConf.directoryUrl = dirUrl; var store = await P._loadStore(storeConf); var account = await A._getOrCreate( greenlock,