Update configs for active hosts only on ddns update

Other changes:
- Fixed null property read error on clients (when switching to public access)
- Use separate `resolvedAddress` field for resolved IP instead of overwriting address
- Reduced ddns log verbosity
This commit is contained in:
Varun Gupta
2023-12-02 22:47:22 -05:00
committed by Varun Gupta
parent 743cdd8b0b
commit 7b09fefd17
4 changed files with 14 additions and 8 deletions

View File

@ -139,12 +139,13 @@ const internalNginx = {
*/
resolveDDNSAddresses: (host) => {
const promises = [];
if (typeof host.access_list !== 'undefined' && typeof host.access_list.clients !== 'undefined') {
if (typeof host.access_list !== 'undefined' && host.access_list && typeof host.access_list.clients !== 'undefined' && host.access_list.clients) {
for (const client of host.access_list.clients) {
if (ddnsResolver.requiresResolution(client.address)) {
const p = ddnsResolver.resolveAddress(client.address)
const address = client.address;
if (ddnsResolver.requiresResolution(address)) {
const p = ddnsResolver.resolveAddress(address)
.then((resolvedIP) => {
client.address = `${resolvedIP}; # ${client.address}`;
Object.defineProperty(client, 'resolvedAddress', {value: resolvedIP});
return Promise.resolve();
});
promises.push(p);