getMissingRequiredSecrets filters requirements to return only missing required secrets. It skips optional secrets and checks both primary and alternative secret names.
(requirements []SecretRequirement, existingSecrets map[string]struct {
})
| 159 | // getMissingRequiredSecrets filters requirements to return only missing required secrets. |
| 160 | // It skips optional secrets and checks both primary and alternative secret names. |
| 161 | func getMissingRequiredSecrets(requirements []SecretRequirement, existingSecrets map[string]struct { |
| 162 | }) []SecretRequirement { |
| 163 | var missing []SecretRequirement |
| 164 | for _, req := range requirements { |
| 165 | // Skip optional secrets - we only care about required ones |
| 166 | if req.Optional { |
| 167 | continue |
| 168 | } |
| 169 | |
| 170 | exists := setutil.Contains(existingSecrets, req.Name) || sliceutil.Any(req.AlternativeEnvVars, func(alt string) bool { |
| 171 | return setutil.Contains(existingSecrets, alt) |
| 172 | }) |
| 173 | if !exists { |
| 174 | missing = append(missing, req) |
| 175 | } |
| 176 | } |
| 177 | return missing |
| 178 | } |
| 179 | |
| 180 | // ctx returns the context from the config, defaulting to background if nil |
| 181 | func (c EngineSecretConfig) ctx() context.Context { |