Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions agent/src/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ export const services: ManagedService[] = [
unit: 'dnsmasq',
async render(config) {
const site = config.site;
// Skip dnsmasq management until the site's DHCP/DNS settings are fully
// configured — the templates need all of these fields.
if (!site?.internalDomain || !site.dhcpRange || !site.subnetMask
|| !site.gateway || !site.dnsForwarders) {
// DHCP and internal DNS can run on an isolated site. Only the core
// DHCP settings are required; gateway and DNS forwarders are optional.
if (!site?.internalDomain || !site.dhcpRange || !site.subnetMask) {
return null;
}
const data = { site };
Expand Down
2 changes: 1 addition & 1 deletion agent/templates/dnsmasq/dhcp-opts.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
option:router,<%= site.gateway %>
<%_ if (site.gateway) { _%>option:router,<%= site.gateway %><%_ } else { _%>option:router<%_ } _%>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArshSSandhu this PR looks good other than this. "@" me when it's fixed and we can get this merged.

4 changes: 2 additions & 2 deletions agent/templates/dnsmasq/servers.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%_ site.dnsForwarders.split(',').forEach((forwarder) => { _%>
server=<%= forwarder.trim() %>
<%_ (site.dnsForwarders || '').split(',').map((forwarder) => forwarder.trim()).filter(Boolean).forEach((forwarder) => { _%>
server=<%= forwarder %>
<%_ }) _%>
Loading