Move getLocationsSync into apps.js

This commit is contained in:
Girish Ramakrishnan
2022-11-17 08:18:07 +01:00
parent 8c2a1906ba
commit 0c8b8346f4
2 changed files with 16 additions and 15 deletions
+12
View File
@@ -65,6 +65,7 @@ exports = module.exports = {
appendLogLine,
getCertificate,
getLocationsSync,
start,
stop,
@@ -2862,3 +2863,14 @@ async function restoreConfig(app) {
await update(app.id, data);
}
function getLocationsSync(app) {
assert.strictEqual(typeof app, 'object');
const locations = [{ domain: app.domain, fqdn: app.fqdn, certificate: app.certificate, type: exports.LOCATION_TYPE_PRIMARY }]
.concat(app.secondaryDomains.map(sd => { return { domain: sd.domain, certificate: sd.certificate, fqdn: sd.fqdn, type: exports.LOCATION_TYPE_SECONDARY }; }))
.concat(app.redirectDomains.map(rd => { return { domain: rd.domain, certificate: rd.certificate, fqdn: rd.fqdn, type: exports.LOCATION_TYPE_REDIRECT }; }))
.concat(app.aliasDomains.map(ad => { return { domain: ad.domain, certificate: ad.certificate, fqdn: ad.fqdn, type: exports.LOCATION_TYPE_ALIAS }; }));
return locations;
}