From b012d585f8beec62cc7b9d260a8400e135512f39 Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Wed, 16 Sep 2026 10:54:19 +0200 Subject: [PATCH] Expose ProjectConfigurator URL in core config --- backend/coreconfig/coreconfig.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/coreconfig/coreconfig.go b/backend/coreconfig/coreconfig.go index 67ff1cd..0f9482d 100644 --- a/backend/coreconfig/coreconfig.go +++ b/backend/coreconfig/coreconfig.go @@ -1,5 +1,5 @@ -// Package coreconfig lets any service in this workspace receive AuthGuard's and CarrierNode's -// current base URL(s) pushed from ProjectConfigurator, instead of each service hardcoding them in +// Package coreconfig lets any service in this workspace receive AuthGuard's, CarrierNode's, and +// ProjectConfigurator's current base URL(s) pushed from ProjectConfigurator, instead of each service hardcoding them in // its own env vars. ProjectConfigurator's Projects workspace is the operator-facing source of // truth for both (its authguard_url/carriernode_url(_N) settings); it pushes a fresh copy to every // project it has registered whenever either changes, and again on a periodic tick, so a service @@ -16,9 +16,14 @@ import ( "sync" ) -// Info is AuthGuard's and CarrierNode's current base URL(s), as pushed by ProjectConfigurator. +// Info is AuthGuard's, CarrierNode's, and ProjectConfigurator's current base URL(s), as pushed by +// ProjectConfigurator. type Info struct { AuthGuardURL string `json:"authGuardUrl"` + // ProjectConfiguratorURL is the ProjectConfigurator instance that owns the current workspace + // configuration. Consumers with independent databases can use it to read settings such as the + // configured mount mappings. + ProjectConfiguratorURL string `json:"projectConfiguratorUrl"` // CarrierNodeURL is the primary CarrierNode instance's URL (CarrierNodeURLs[0], if any) - kept // for the services that only ever talk to one CarrierNode instance via @@ -58,6 +63,9 @@ func (s *Store) Get() Info { // authclient.Client's SetBaseURL, or (via OnUpdate) to keep one continuously up to date. func (s *Store) AuthGuardURL() string { return s.Get().AuthGuardURL } +// ProjectConfiguratorURL is a convenience accessor for Get().ProjectConfiguratorURL. +func (s *Store) ProjectConfiguratorURL() string { return s.Get().ProjectConfiguratorURL } + // CarrierNodeURL is a convenience accessor for Get().CarrierNodeURL - the natural closure to wire // as a single-instance carriernodeclient.Client's BaseURL: carriernodeclient.New(secret, func(ctx // context.Context) string { return store.CarrierNodeURL() }). @@ -87,6 +95,9 @@ func (s *Store) Set(next Info) { if url := strings.TrimSpace(next.AuthGuardURL); url != "" { s.info.AuthGuardURL = url } + if url := strings.TrimRight(strings.TrimSpace(next.ProjectConfiguratorURL), "/"); url != "" { + s.info.ProjectConfiguratorURL = url + } if len(next.CarrierNodeURLs) > 0 { s.info.CarrierNodeURLs = next.CarrierNodeURLs s.info.CarrierNodeURL = next.CarrierNodeURLs[0]