provision: add ipv6 config

This commit is contained in:
Girish Ramakrishnan
2024-04-25 19:33:04 +02:00
parent 017e46fa0f
commit 2f425f8119
7 changed files with 79 additions and 38 deletions
+6 -2
View File
@@ -90,9 +90,10 @@ async function setupTask(domain, auditSource) {
gStatus.setup.active = false;
}
async function setup(domainConfig, ipv4Config, auditSource) {
async function setup(domainConfig, ipv4Config, ipv6Config, auditSource) {
assert.strictEqual(typeof domainConfig, 'object');
assert.strictEqual(typeof ipv4Config, 'object');
assert.strictEqual(typeof ipv6Config, 'object');
assert.strictEqual(typeof auditSource, 'object');
if (gStatus.setup.active || gStatus.restore.active) throw new BoxError(BoxError.BAD_STATE, 'Already setting up or restoring');
@@ -122,6 +123,7 @@ async function setup(domainConfig, ipv4Config, auditSource) {
await mailServer.setLocation(constants.DASHBOARD_SUBDOMAIN, domain); // default mail location. do this before we add the domain for upserting mail DNS
await domains.add(domain, data, auditSource);
await network.setIPv4Config(ipv4Config);
await network.setIPv6Config(ipv6Config);
safe(setupTask(domain, auditSource), { debug }); // now that args are validated run the task in the background
} catch (error) {
@@ -160,10 +162,11 @@ async function activate(username, password, email, displayName, ip, auditSource)
};
}
async function restoreTask(backupConfig, remotePath, ipv4Config, options, auditSource) {
async function restoreTask(backupConfig, remotePath, ipv4Config, ipv6Config, options, auditSource) {
assert.strictEqual(typeof backupConfig, 'object');
assert.strictEqual(typeof remotePath, 'string');
assert.strictEqual(typeof ipv4Config, 'object');
assert.strictEqual(typeof ipv6Config, 'object');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof auditSource, 'object');
@@ -180,6 +183,7 @@ async function restoreTask(backupConfig, remotePath, ipv4Config, options, auditS
await ensureDhparams();
await network.setIPv4Config(ipv4Config);
await network.setIPv6Config(ipv6Config);
await reverseProxy.restoreFallbackCertificates();
const location = await dashboard.getLocation(); // load this fresh from after the backup.restore