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

Commit 8bb2e97

Browse files
committed
Rename osEnv to referenceEnv and make it private
1 parent 6035983 commit 8bb2e97

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

internals/secrethub/run.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ func (cmd *RunCommand) Run() error {
114114

115115
osEnv, passthroughEnv := parseKeyValueStringsToMap(cmd.osEnv())
116116

117-
osEnvSource := NewOsEnvSource(osEnv)
118-
envSources = append(envSources, osEnvSource)
117+
referenceEnv := NewReferenceEnv(osEnv)
118+
envSources = append(envSources, referenceEnv)
119119

120120
// TODO: Validate the flags when parsing by implementing the Flag interface for EnvFlags.
121121
flagSource, err := NewEnvFlags(cmd.envar)
@@ -424,29 +424,29 @@ func ReadEnvFile(filepath string, varReader tpl.VariableReader, parser tpl.Parse
424424
}, nil
425425
}
426426

427-
// OsEnv is an environment with secrets configured with the
427+
// referenceEnv is an environment with secrets configured with the
428428
// secrethub:// syntax in the os environment variables.
429-
type OsEnv struct {
429+
type referenceEnv struct {
430430
envVars map[string]string
431431
}
432432

433-
// NewOsEnvSource returns an environment with secrets configured in the
433+
// NewReferenceEnv returns an environment with secrets configured in the
434434
// os environment with the secrethub:// syntax.
435-
func NewOsEnvSource(osEnv map[string]string) *OsEnv {
435+
func NewReferenceEnv(osEnv map[string]string) *referenceEnv {
436436
envVars := make(map[string]string)
437437
for key, value := range osEnv {
438438
if strings.HasPrefix(value, "secrethub://") {
439439
envVars[key] = strings.TrimPrefix(value, "secrethub://")
440440
}
441441
}
442-
return &OsEnv{
442+
return &referenceEnv{
443443
envVars: envVars,
444444
}
445445
}
446446

447447
// Env returns a map of key value pairs with the secrets configured with the
448448
// secrethub:// syntax.
449-
func (env *OsEnv) Env(_ map[string]string, secretReader tpl.SecretReader) (map[string]string, error) {
449+
func (env *referenceEnv) Env(_ map[string]string, secretReader tpl.SecretReader) (map[string]string, error) {
450450
envVarsWithSecrets := make(map[string]string)
451451
for key, path := range env.envVars {
452452
secret, err := secretReader.ReadSecret(path)
@@ -458,9 +458,7 @@ func (env *OsEnv) Env(_ map[string]string, secretReader tpl.SecretReader) (map[s
458458
return envVarsWithSecrets, nil
459459
}
460460

461-
// Secrets returns a slice of secrets used in the environment, namely the ones
462-
// configured with the secrethub:// syntax.
463-
func (env *OsEnv) Secrets() []string {
461+
func (env *referenceEnv) Secrets() []string {
464462
return nil
465463
}
466464

0 commit comments

Comments
 (0)