Skip to content

Auto-detect NS_SERVER_IP at API boot #84

@rdemeritt

Description

@rdemeritt

Problem

NS_SERVER_IP is captured once by scripts/setup.sh. If the host LAN IP later changes (DHCP lease, network move, new interface), Technitium A records become stale silently. New site provisioning writes wrong addresses; existing zones drift.

Proposal

At API boot:

  • Resolve primary non-loopback interface IP via os.networkInterfaces()
  • Compare to NS_SERVER_IP from env
  • Mismatch → log loud warning, surface in dashboard health panel
  • Optional: support NS_SERVER_IP=auto to bypass env override and always use detected value

~25 LOC + unit test.

Acceptance

  • API boot logs detected interface IP
  • Mismatch with env → warning log + dashboard banner
  • NS_SERVER_IP=auto writes detected IP into DNS A records
  • Existing fixed-IP behavior preserved when env is a real IP that matches an interface

Out of scope

  • Active zone-record reconciliation when IP changes mid-uptime (separate enhancement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions