set directoryUrl for store

This commit is contained in:
AJ ONeal 2019-11-29 17:25:21 -07:00
parent c945da9b48
commit 63e6ff0b22
1 changed files with 9 additions and 7 deletions

View File

@ -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,