From b140b7b4e1b7d6941264706e68e802ea61f04f04 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 15 Dec 2020 11:02:51 +0100 Subject: command: Filter `AllowedEnviroment()` via explicit slice The `AllowedEnvironment()` function currently operates on the real environment directly, which makes it quite inflexible as one cannot filter a different environment. As we're about to move filtering of the allowed environment into the hooks manager, which only has those variables in the incoming environment slice, this commit refactors the function to instead filter a given slice. --- cmd/gitaly-hooks/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/gitaly-hooks') diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go index 99598b2b4..b1164f410 100644 --- a/cmd/gitaly-hooks/hooks.go +++ b/cmd/gitaly-hooks/hooks.go @@ -221,7 +221,7 @@ func dialGitaly(payload git.HooksPayload) (*grpc.ClientConn, error) { } func hookEnvironment(payload git.HooksPayload) ([]string, error) { - environment := command.AllowedEnvironment() + environment := command.AllowedEnvironment(os.Environ()) for _, kv := range os.Environ() { if strings.HasPrefix(kv, "GL_") { -- cgit v1.2.3