Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 6035983

Browse files
committed
Update OsEnv to use secret reader
1 parent d6d8d44 commit 6035983

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

internals/secrethub/run.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,22 @@ func NewOsEnvSource(osEnv map[string]string) *OsEnv {
446446

447447
// Env returns a map of key value pairs with the secrets configured with the
448448
// secrethub:// syntax.
449-
func (env *OsEnv) Env(secrets map[string]string, _ tpl.SecretReader) (map[string]string, error) {
449+
func (env *OsEnv) Env(_ map[string]string, secretReader tpl.SecretReader) (map[string]string, error) {
450450
envVarsWithSecrets := make(map[string]string)
451451
for key, path := range env.envVars {
452-
envVarsWithSecrets[key] = secrets[path]
452+
secret, err := secretReader.ReadSecret(path)
453+
if err != nil {
454+
return nil, err
455+
}
456+
envVarsWithSecrets[key] = secret
453457
}
454458
return envVarsWithSecrets, nil
455459
}
456460

457461
// Secrets returns a slice of secrets used in the environment, namely the ones
458462
// configured with the secrethub:// syntax.
459463
func (env *OsEnv) Secrets() []string {
460-
secrets := make([]string, len(env.envVars))
461-
i := 0
462-
for _, path := range env.envVars {
463-
secrets[i] = path
464-
i++
465-
}
466-
return secrets
464+
return nil
467465
}
468466

469467
// EnvFile contains an environment that is read from a file.

0 commit comments

Comments
 (0)