Sync shared snapshot from e4c1826
Docker / Docker Build & Push (push) Successful in 4m6s

This commit is contained in:
Gabriel20xx committed 2026-09-16 19:53:47 +02:00
1 parent 6e70b7e8c1
commit c097383d3a
3 files changed
+43 -5

No files matched your search

@@ -41,6 +41,12 @@ type Client struct {
// calls from public traffic. Empty means no header is sent.
InternalServiceSecret string
// InternalServiceSecretFunc, when set, resolves the current secret for
// each request. This lets callers use ProjectConfigurator's live
// per-service secret while retaining InternalServiceSecret as the
// bootstrap/fallback value.
InternalServiceSecretFunc func(ctx context.Context) string
// BaseURL resolves CarrierNode's current base URL for a request. It is a
// function rather than a fixed string because CarrierNode's URL is
// configured live through ProjectConfigurator's Projects workspace
@@ -123,8 +129,12 @@ func (c *Client) newRequest(ctx context.Context, baseURL, method, path string, b
if err != nil {
return nil, err
}
if c.InternalServiceSecret != "" {
request.Header.Set("X-Internal-Auth", c.InternalServiceSecret)
secret := c.InternalServiceSecret
if c.InternalServiceSecretFunc != nil {
secret = strings.TrimSpace(c.InternalServiceSecretFunc(ctx))
}
if secret != "" {
request.Header.Set("X-Internal-Auth", secret)
}
return request, nil
}