Sync shared snapshot from 389dd86
This commit is contained in:
1 parent
55b224bc48
commit
74afed9a13
2 files changed
+28
-4
No files matched your search
@@ -28,6 +28,10 @@ type Info struct {
|
||||
// configuration. Consumers with independent databases can use it to read settings such as the
|
||||
// configured mount mappings.
|
||||
ProjectConfiguratorURL string `json:"projectConfiguratorUrl"`
|
||||
// ContentScannerURL and ContentScannerSecret let services with independent databases import
|
||||
// the scanner's successfully discovered media without connecting to its PostgreSQL database.
|
||||
ContentScannerURL string `json:"contentScannerUrl,omitempty"`
|
||||
ContentScannerSecret string `json:"contentScannerSecret,omitempty"`
|
||||
|
||||
// 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
|
||||
@@ -78,6 +82,12 @@ 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 }
|
||||
|
||||
// ContentScannerURL is a convenience accessor for Get().ContentScannerURL.
|
||||
func (s *Store) ContentScannerURL() string { return s.Get().ContentScannerURL }
|
||||
|
||||
// ContentScannerSecret is the credential the scanner expects on internal sync requests.
|
||||
func (s *Store) ContentScannerSecret() string { return s.Get().ContentScannerSecret }
|
||||
|
||||
// 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() }).
|
||||
@@ -116,6 +126,12 @@ func (s *Store) Set(next Info) {
|
||||
if url := strings.TrimRight(strings.TrimSpace(next.ProjectConfiguratorURL), "/"); url != "" {
|
||||
s.info.ProjectConfiguratorURL = url
|
||||
}
|
||||
if url := strings.TrimRight(strings.TrimSpace(next.ContentScannerURL), "/"); url != "" {
|
||||
s.info.ContentScannerURL = url
|
||||
}
|
||||
if secret := strings.TrimSpace(next.ContentScannerSecret); secret != "" {
|
||||
s.info.ContentScannerSecret = secret
|
||||
}
|
||||
if secret := strings.TrimSpace(next.CarrierNodeSecret); secret != "" {
|
||||
s.info.CarrierNodeSecret = secret
|
||||
}
|
||||
@@ -173,10 +189,11 @@ func Handler(secret string, store *Store) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
store.Set(input)
|
||||
// Do not echo the CarrierNode credential to the caller. The push is
|
||||
// authenticated, but the credential is needed only by the recipient.
|
||||
// Do not echo service credentials to the caller. The push is authenticated, but
|
||||
// these credentials are needed only by the recipient.
|
||||
info := store.Get()
|
||||
info.CarrierNodeSecret = ""
|
||||
info.ContentScannerSecret = ""
|
||||
writeJSON(w, http.StatusOK, map[string]any{"ok": true, "info": info})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user