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

Commit f7dd9b1

Browse files
committed
Moved 'secrethub://' to a constant
1 parent 152294a commit f7dd9b1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internals/secrethub/run.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ const (
4949
// templateVarEnvVarPrefix is used to prefix environment variables
5050
// that should be used as template variables.
5151
templateVarEnvVarPrefix = "SECRETHUB_VAR_"
52+
// prefix of the values of environment variables that will be
53+
// substituted with secrets
54+
secretReferencePrefix = "secrethub://"
5255
)
5356

5457
// RunCommand runs a program and passes environment variables to it that are
@@ -435,8 +438,8 @@ type referenceEnv struct {
435438
func newReferenceEnv(osEnv map[string]string) *referenceEnv {
436439
envVars := make(map[string]string)
437440
for key, value := range osEnv {
438-
if strings.HasPrefix(value, "secrethub://") {
439-
envVars[key] = strings.TrimPrefix(value, "secrethub://")
441+
if strings.HasPrefix(value, secretReferencePrefix) {
442+
envVars[key] = strings.TrimPrefix(value, secretReferencePrefix)
440443
}
441444
}
442445
return &referenceEnv{

0 commit comments

Comments
 (0)