From 7b7b32501739ff84949e76d8024d7a3076af61c6 Mon Sep 17 00:00:00 2001 From: Steven Terwindt Date: Thu, 23 Jul 2026 07:21:12 +1000 Subject: [PATCH] fix(apply): restore SecretLookup after config reload When before-apply scripts run, the template context is recreated from the reloaded config but SecretLookup was not re-assigned. This caused templates with bitwarden() calls to fail with "secrets not configured" even after a successful 'mate secrets fetch'. --- internal/cli/apply.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/cli/apply.go b/internal/cli/apply.go index b13f550..7df358c 100644 --- a/internal/cli/apply.go +++ b/internal/cli/apply.go @@ -154,6 +154,12 @@ func runApply(cmd *cobra.Command, args []string) error { if err != nil { return fmt.Errorf("reloading template context: %w", err) } + if mgrErr == nil { + tmplCtx.SecretLookup = func(item, typ, field string) (string, error) { + key := secrets.CacheKey{Provider: "bitwarden", Item: item, Type: typ, Field: field} + return mgr.Get(key) + } + } } }