From 9de23113575a255d91a34a8e0d245d5c926278b6 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Thu, 9 Jul 2026 20:30:34 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20Remove=20RegisterSelf=20=E2=80=94?= =?UTF-8?q?=20Central=20domain=20from=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Central no longer self-registers as a service. Its own domain comes from config (cloud.central.domain) and is injected directly into reconciliation as an HTTPRoute. This is cleaner — Central's own services are config-driven, not registration-driven. Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/api/v1/handlers.go | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/internal/api/v1/handlers.go b/internal/api/v1/handlers.go index 3b6078c..f965def 100644 --- a/internal/api/v1/handlers.go +++ b/internal/api/v1/handlers.go @@ -110,39 +110,6 @@ func envOrDefault(key, defaultVal string) string { return defaultVal } -// RegisterSelf registers Wild Central's own UI as a service so it gets -// DNS + proxy + TLS via its own networking stack. Idempotent — safe to -// call on every startup. Skips silently if no domain is configured. -func (api *API) RegisterSelf(port int) { - globalConfigPath := filepath.Join(api.dataDir, "config.yaml") - globalCfg, err := config.LoadGlobalConfig(globalConfigPath) - if err != nil { - return - } - - domain := globalCfg.Cloud.Central.Domain - if domain == "" { - return - } - - svc := services.Service{ - Source: "wild-central", - Domain: domain, - Backend: services.Backend{ - Address: fmt.Sprintf("127.0.0.1:%d", port), - Type: services.BackendHTTP, - }, - Reach: services.ReachInternal, - TLS: services.TLSTerminate, - } - - if err := api.services.Register(svc); err != nil { - slog.Warn("failed to self-register", "domain", domain, "error", err) - } else { - slog.Info("registered wild-central", "domain", domain) - } -} - // StartDDNS loads DDNS config and starts the background goroutine. func (api *API) StartDDNS(ctx gocontext.Context) { api.ctx = ctx