proper task name for dashboard change

This commit is contained in:
Girish Ramakrishnan
2023-08-14 09:40:31 +05:30
parent abff970169
commit 4acbb7136a
13 changed files with 77 additions and 87 deletions
+6 -4
View File
@@ -26,7 +26,6 @@ const assert = require('assert'),
BoxError = require('./boxerror.js'),
constants = require('./constants.js'),
crypto = require('crypto'),
dashboard = require('./dashboard.js'),
debug = require('debug')('box:mailserver'),
dns = require('./dns.js'),
docker = require('./docker.js'),
@@ -265,14 +264,17 @@ async function changeLocation(auditSource, progressCallback) {
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof progressCallback, 'function');
const { fqdn, domain, subdomain } = await getLocation();
const location = await getLocation();
const fqdn = dns.fqdn(location.subdomain, location.domain);
let progress = 20;
progressCallback({ percent: progress, message: `Setting up DNS of certs of mail server ${fqdn}` });
await dashboard.setupDnsAndCert(subdomain, domain, auditSource, (progress) => progressCallback({ message: progress.message })); // remove the percent
const allDomains = await domains.list();
await dns.registerLocations([location], { overwriteDns: true }, progressCallback);
await dns.waitForLocations([location], progressCallback);
await reverseProxy.ensureCertificate(location, {}, auditSource);
const allDomains = await domains.list();
for (let idx = 0; idx < allDomains.length; idx++) {
const domainObject = allDomains[idx];
progressCallback({ percent: progress, message: `Updating DNS of ${domainObject.domain}` });