Compare commits

..
2 Commits
Author SHA1 Message Date
Gabriel20xx 6e70b7e8c1 Sync shared snapshot from 4b0566e
Docker / Docker Build & Push (push) Successful in 3m10s
2026-09-16 11:51:21 +02:00
Gabriel20xx dc04ac4360 Sync shared snapshot from b012d58 2026-09-16 10:54:57 +02:00
2 changed files with 34 additions and 3 deletions

No files matched your search

+24 -3
View File
@@ -1,5 +1,6 @@
// 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,
// ComfyUI'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 +17,17 @@ 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"`
// ComfyUIURL is the configured ComfyUI endpoint for services that use the
// generator. It is optional so services that do not use ComfyUI can ignore it.
ComfyUIURL string `json:"comfyUiUrl,omitempty"`
// 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 +67,12 @@ 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 }
// ComfyUIURL is a convenience accessor for Get().ComfyUIURL.
func (s *Store) ComfyUIURL() string { return s.Get().ComfyUIURL }
// 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 +102,12 @@ func (s *Store) Set(next Info) {
if url := strings.TrimSpace(next.AuthGuardURL); url != "" {
s.info.AuthGuardURL = url
}
if url := strings.TrimRight(strings.TrimSpace(next.ComfyUIURL), "/"); url != "" {
s.info.ComfyUIURL = 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]
@@ -22,6 +22,16 @@ func TestStoreSetIgnoresBlankFields(t *testing.T) {
}
}
func TestStoreSetComfyUIURL(t *testing.T) {
store := NewStore(Info{})
store.Set(Info{ComfyUIURL: "http://comfyui:8188/"})
if got := store.ComfyUIURL(); got != "http://comfyui:8188" {
t.Fatalf("ComfyUIURL = %q, want trimmed URL", got)
}
}
func TestStoreOnUpdateFiresWithNewInfo(t *testing.T) {
store := NewStore(Info{})
var got Info