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

@ -64,15 +64,13 @@ const ddnsResolver = {
* @returns {Promise}
*/
_queryHost: (host) => {
logger.info('Looking up IP for ', host);
return utils.execSafe('getent', ['hosts', host])
.then((result) => {
if (result.length < 8) {
logger.error('IP lookup returned invalid output: ', result);
logger.error(`IP lookup for ${host} returned invalid output: ${result}`);
throw error.ValidationError('Invalid output from getent hosts');
}
const out = result.split(/\s+/);
logger.info(`Resolved ${host} to ${out[0]}`);
return out[0];
},
(error) => {

View File

@ -113,7 +113,11 @@ const ddnsUpdater = {
for (const row of rows) {
if (!updatedRows.has(row.id)) {
updatedRows.set(row.id, 1);
proxy_hosts.push(...row.proxy_hosts);
for (const host of row.proxy_hosts) {
if (host.enabled) {
proxy_hosts.push(host);
}
}
}
}
}