reorder functions for no-use-before-define
This commit is contained in:
+18
-19
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user