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; return renewedOrFailed;
}; };
greenlock._acme = async function(mconf, args) { greenlock._acme = async function(mconf, args, dirUrl) {
var packageAgent = gconf.packageAgent || ''; var packageAgent = gconf.packageAgent || '';
// because Greenlock_Express/v3.x Greenlock/v3 is redundant // because Greenlock_Express/v3.x Greenlock/v3 is redundant
if (!/greenlock/i.test(packageAgent)) { if (!/greenlock/i.test(packageAgent)) {
@ -387,11 +387,6 @@ G.create = function(gconf) {
debug: greenlock._defaults.debug || args.debug debug: greenlock._defaults.debug || args.debug
}); });
var dirUrl = DIR._getDirectoryUrl(
args.directoryUrl || mconf.directoryUrl,
args.servername
);
var dir = caches[dirUrl]; var dir = caches[dirUrl];
// don't cache more than an hour // don't cache more than an hour
if (dir && Date.now() - dir.ts < 1 * 60 * 60 * 1000) { if (dir && Date.now() - dir.ts < 1 * 60 * 60 * 1000) {
@ -420,7 +415,13 @@ G.create = function(gconf) {
}; };
greenlock._order = async function(mconf, siteConf) { greenlock._order = async function(mconf, siteConf) {
// packageAgent, maintainerEmail // 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; var storeConf = siteConf.store || mconf.store;
storeConf = JSON.parse(JSON.stringify(storeConf)); storeConf = JSON.parse(JSON.stringify(storeConf));
storeConf.packageRoot = gconf.packageRoot; storeConf.packageRoot = gconf.packageRoot;
@ -433,6 +434,7 @@ G.create = function(gconf) {
gconf.packageRoot || process.cwd(), gconf.packageRoot || process.cwd(),
storeConf.basePath storeConf.basePath
); );
storeConf.directoryUrl = dirUrl;
var store = await P._loadStore(storeConf); var store = await P._loadStore(storeConf);
var account = await A._getOrCreate( var account = await A._getOrCreate(
greenlock, greenlock,