fix(amp): update explicit API key on config change

This commit is contained in:
hkfires
2025-12-04 19:32:44 +08:00
parent bceecfb2e3
commit 969ff6bb68
2 changed files with 12 additions and 0 deletions

View File

@@ -139,6 +139,17 @@ func (s *MultiSourceSecret) InvalidateCache() {
s.cache = nil
}
// UpdateExplicitKey refreshes the config-provided key and clears cache.
func (s *MultiSourceSecret) UpdateExplicitKey(key string) {
if s == nil {
return
}
s.mu.Lock()
s.explicitKey = strings.TrimSpace(key)
s.cache = nil
s.mu.Unlock()
}
// StaticSecretSource returns a fixed API key (for testing)
type StaticSecretSource struct {
key string