reorder functions for no-use-before-define

This commit is contained in:
Girish Ramakrishnan
2026-02-14 16:34:34 +01:00
parent 36aa641cb9
commit e9f96593c3
31 changed files with 2621 additions and 2648 deletions
+18 -19
View File
@@ -20,9 +20,6 @@ import userDirectory from './user-directory.js';
const debug = debugModule('box:dashboard');
const _setLocation = setLocation;
async function getLocation() {
const domain = await settings.get(settings.DASHBOARD_DOMAIN_KEY);
const subdomain = await settings.get(settings.DASHBOARD_SUBDOMAIN_KEY);
@@ -73,6 +70,22 @@ async function getConfig() {
};
}
async function prepareLocation(subdomain, domain, auditSource, progressCallback) {
assert.strictEqual(typeof subdomain, 'string');
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof progressCallback, 'function');
const location = { subdomain, domain };
const fqdn = dns.fqdn(subdomain, domain);
progressCallback({ percent: 20, message: `Updating DNS of ${fqdn}` });
await dns.registerLocations([location], { overwriteDns: true }, progressCallback);
progressCallback({ percent: 40, message: `Waiting for DNS of ${fqdn}` });
await dns.waitForLocations([location], progressCallback);
progressCallback({ percent: 60, message: `Getting certificate of ${fqdn}` });
await reverseProxy.ensureCertificate(location, {}, auditSource);
}
async function startPrepareLocation(domain, auditSource) {
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof auditSource, 'object');
@@ -96,22 +109,6 @@ async function startPrepareLocation(domain, auditSource) {
return taskId;
}
async function prepareLocation(subdomain, domain, auditSource, progressCallback) {
assert.strictEqual(typeof subdomain, 'string');
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof progressCallback, 'function');
const location = { subdomain, domain };
const fqdn = dns.fqdn(subdomain, domain);
progressCallback({ percent: 20, message: `Updating DNS of ${fqdn}` });
await dns.registerLocations([location], { overwriteDns: true }, progressCallback);
progressCallback({ percent: 40, message: `Waiting for DNS of ${fqdn}` });
await dns.waitForLocations([location], progressCallback);
progressCallback({ percent: 60, message: `Getting certificate of ${fqdn}` });
await reverseProxy.ensureCertificate(location, {}, auditSource);
}
async function setupLocation(subdomain, domain, auditSource) {
assert.strictEqual(typeof subdomain, 'string');
assert.strictEqual(typeof domain, 'string');
@@ -141,6 +138,8 @@ async function changeLocation(subdomain, domain, auditSource) {
await safe(reverseProxy.removeDashboardConfig(oldLocation.subdomain, oldLocation.domain), { debug });
}
const _setLocation = setLocation;
export default {
getLocation,
clearLocation,