Development

This commit is contained in:
Matthew Grotke 2026-05-22 02:21:50 -04:00
parent f320132e61
commit 9f71fe31a6

View file

@ -418,13 +418,15 @@ def setup_caddy(domain, email):
def _lan_ip():
"""Best-effort local LAN IP for the informational message."""
"""Read the LAN IP from routlin's networkd config files."""
import glob
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
for path in sorted(glob.glob("/etc/systemd/network/10-routlin-*.network")):
for m in re.finditer(r'^Address=(\d+\.\d+\.\d+\.\d+)/', Path(path).read_text(), re.MULTILINE):
return m.group(1)
except Exception:
return "127.0.0.1"
pass
return "this server"
# ===================================================================