From c33266ce03e3a58a20e2b6c0130dbe0226155d68 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 8 Feb 2023 23:07:53 +0100 Subject: [PATCH] dyndns: update secondary/redirect/alias domains as well --- src/dyndns.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dyndns.js b/src/dyndns.js index b94565f19..8bce9c3a2 100644 --- a/src/dyndns.js +++ b/src/dyndns.js @@ -44,8 +44,15 @@ async function sync(auditSource) { // do not change state of installing apps since apptask will error if dns record already exists if (app.installationState !== apps.ISTATE_INSTALLED) continue; - if (ipv4Changed) await dns.upsertDnsRecords(app.subdomain, app.domain, 'A', [ ipv4 ]); - if (ipv6Changed) await dns.upsertDnsRecords(app.subdomain, app.domain, 'AAAA', [ ipv6 ]); + const locations = [{ domain: app.domain, subdomain: app.subdomain }] + .concat(app.secondaryDomains.map(sd => { return { domain: sd.domain, subdomain: sd.subdomain }; })) + .concat(app.redirectDomains.map(rd => { return { domain: rd.domain, subdomain: rd.subdomain }; })) + .concat(app.aliasDomains.map(ad => { return { domain: ad.domain, subdomain: ad.subdomain }; })); + + for (const location of locations) { + if (ipv4Changed) await dns.upsertDnsRecords(location.subdomain, location.domain, 'A', [ ipv4 ]); + if (ipv6Changed) await dns.upsertDnsRecords(location.subdomain, location.domain, 'AAAA', [ ipv6 ]); + } } debug('refreshDNS: updated apps');