From 6e70b7e8c149bfe155decc6bd6d605696f04bad5 Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Wed, 16 Sep 2026 11:50:55 +0200 Subject: [PATCH] Sync shared snapshot from 4b0566e --- shared/backend/coreconfig/coreconfig.go | 12 +++++++++++- shared/backend/coreconfig/coreconfig_test.go | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/shared/backend/coreconfig/coreconfig.go b/shared/backend/coreconfig/coreconfig.go index 0f9482d..d76ca67 100644 --- a/shared/backend/coreconfig/coreconfig.go +++ b/shared/backend/coreconfig/coreconfig.go @@ -1,4 +1,5 @@ -// Package coreconfig lets any service in this workspace receive AuthGuard's, CarrierNode's, and +// 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 @@ -20,6 +21,9 @@ import ( // 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. @@ -63,6 +67,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 } +// 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 } @@ -95,6 +102,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.ComfyUIURL), "/"); url != "" { + s.info.ComfyUIURL = url + } if url := strings.TrimRight(strings.TrimSpace(next.ProjectConfiguratorURL), "/"); url != "" { s.info.ProjectConfiguratorURL = url } diff --git a/shared/backend/coreconfig/coreconfig_test.go b/shared/backend/coreconfig/coreconfig_test.go index 4744294..c435968 100644 --- a/shared/backend/coreconfig/coreconfig_test.go +++ b/shared/backend/coreconfig/coreconfig_test.go @@ -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