Skip to content

Commit 7f3a45a

Browse files
committed
fix(config): fixed-text error for an unresolvable api_key reference
1 parent a58e22d commit 7f3a45a

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎internal/config/api_key_env.go‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ func resolveAPIKeyRef(c *Config) error {
103103
}
104104
resolved, err := secret.NewResolver().ExpandSecretRefs(context.Background(), c.APIKey)
105105
if err != nil {
106-
// ExpandSecretRefs prefixes its error with the reference text; the
107-
// operator already knows which field this is, so report the cause only.
108-
if cause := errors.Unwrap(err); cause != nil {
109-
err = cause
110-
}
111-
return fmt.Errorf("api_key: could not resolve the reference: %w", err)
106+
// The error is deliberately a fixed sentence: ExpandSecretRefs' own
107+
// text quotes the reference, and the api_key field is the one value
108+
// no error or log line may carry. The operator knows which field it is.
109+
return errors.New("api_key: could not resolve the secret reference; check that the referenced file, environment variable or keyring entry exists and is readable")
112110
}
113111
if resolved == "" {
114112
return fmt.Errorf("api_key: the reference resolved to an empty value")

0 commit comments

Comments
 (0)