dashboard: remove old domain config on switch
This commit is contained in:
@@ -25,6 +25,7 @@ exports = module.exports = {
|
||||
writeDashboardConfig,
|
||||
writeAppConfigs,
|
||||
|
||||
removeDashboardConfig,
|
||||
removeAppConfigs,
|
||||
restoreFallbackCertificates,
|
||||
|
||||
@@ -472,7 +473,7 @@ async function writeDashboardNginxConfig(vhost, certificatePath) {
|
||||
async function writeDashboardConfig(domain) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
|
||||
debug(`writeDashboardConfig: writing admin config for ${domain}`);
|
||||
debug(`writeDashboardConfig: writing dashboard config for ${domain}`);
|
||||
|
||||
const dashboardFqdn = dns.fqdn(constants.DASHBOARD_SUBDOMAIN, domain);
|
||||
const location = { domain, fqdn: dashboardFqdn, certificate: null };
|
||||
@@ -481,6 +482,19 @@ async function writeDashboardConfig(domain) {
|
||||
await reload();
|
||||
}
|
||||
|
||||
async function removeDashboardConfig(domain) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
|
||||
debug(`removeDashboardConfig: removing dashboard config of ${domain}`);
|
||||
|
||||
const vhost = dns.fqdn(constants.DASHBOARD_SUBDOMAIN, domain);
|
||||
const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, `dashboard/${vhost}.conf`);
|
||||
|
||||
if (!safe.fs.unlinkSync(nginxConfigFilename)) throw new BoxError(BoxError.FS_ERROR, safe.error.message);
|
||||
|
||||
await reload();
|
||||
}
|
||||
|
||||
async function writeAppLocationNginxConfig(app, location, certificatePath) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof location, 'object');
|
||||
|
||||
Reference in New Issue
Block a user