do not prefix specified environment variable name with HOOK_ (fixes #98)

This commit is contained in:
Adnan Hajdarevic 2016-09-29 19:15:51 +02:00
parent 923b0c6daa
commit 3b59539a33
2 changed files with 2 additions and 2 deletions

View file

@ -367,7 +367,7 @@ func (h *Hook) ExtractCommandArgumentsForEnv(headers, query, payload *map[string
if arg, ok := h.PassEnvironmentToCommand[i].Get(headers, query, payload); ok { if arg, ok := h.PassEnvironmentToCommand[i].Get(headers, query, payload); ok {
if h.PassEnvironmentToCommand[i].EnvName != "" { if h.PassEnvironmentToCommand[i].EnvName != "" {
// first try to use the EnvName if specified // first try to use the EnvName if specified
args = append(args, EnvNamespace+h.PassEnvironmentToCommand[i].EnvName+"="+arg) args = append(args, h.PassEnvironmentToCommand[i].EnvName+"="+arg)
} else { } else {
// then fallback on the name // then fallback on the name
args = append(args, EnvNamespace+h.PassEnvironmentToCommand[i].Name+"="+arg) args = append(args, EnvNamespace+h.PassEnvironmentToCommand[i].Name+"="+arg)

View file

@ -179,7 +179,7 @@ var hookExtractCommandArgumentsForEnvTests = []struct {
"test", "test",
[]Argument{Argument{"header", "a", "MYKEY"}}, []Argument{Argument{"header", "a", "MYKEY"}},
&map[string]interface{}{"a": "z"}, nil, nil, &map[string]interface{}{"a": "z"}, nil, nil,
[]string{"HOOK_MYKEY=z"}, []string{"MYKEY=z"},
true, true,
}, },
// failures // failures