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) <noreply@anthropic.com>
This commit is contained in:
2026-07-09 20:57:59 +00:00
parent e5cd6583f2
commit 995d2cd7da

View File

@@ -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)