From 995d2cd7daee969882dc3b9656be06b38127d43f Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Thu, 9 Jul 2026 20:57:59 +0000 Subject: [PATCH] fix: Run Reconcile after SetPort so Central routes to correct port Reconcile() was called before SetPort(), so getRunningPort() returned the default 5055 (Wild Cloud's port) instead of 15055. Moved Reconcile() after SetPort(port) so Central's config-driven HAProxy route points to the actual running port. Co-Authored-By: Claude Opus 4.6 (1M context) --- main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 9819579..e3b458c 100644 --- a/main.go +++ b/main.go @@ -116,10 +116,6 @@ func main() { api.StartCentralStatusBroadcaster(startTime) slog.Info("central status broadcaster started") - // Run initial reconciliation so Central's own domain (from config) gets - // DNS + HAProxy routes even with zero registered services. - api.Reconcile() - api.StartDDNS(ctx) router := mux.NewRouter() @@ -154,8 +150,11 @@ func main() { fmt.Sscanf(v, "%d", &port) } - // Tell the API what port it's running on (used for config-driven HAProxy routes) + // Tell the API what port it's running on and run initial reconciliation. + // Must happen AFTER port is known so Central's config-driven HAProxy + // route points to the correct port. api.SetPort(port) + api.Reconcile() addr := fmt.Sprintf("%s:%d", host, port) slog.Info("wild-central started", "addr", addr, "version", Version)