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)