From d539068dc372e46d10adee89e9b96b59156a2bb6 Mon Sep 17 00:00:00 2001 From: Lucas Charles Date: Wed, 17 Feb 2021 13:49:46 -0800 Subject: chore: Refactor env introspection to rely on command initialization Refactors introspection of execution environment to rely on per-connection state (`gitlab-shell`) or per request (`gitlab-sshd`) Relates to https://gitlab.com/gitlab-org/gitlab-shell/-/issues/496 --- cmd/gitlab-shell/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd/gitlab-shell/main.go') diff --git a/cmd/gitlab-shell/main.go b/cmd/gitlab-shell/main.go index 4db54f9..8286e66 100644 --- a/cmd/gitlab-shell/main.go +++ b/cmd/gitlab-shell/main.go @@ -10,6 +10,7 @@ import ( "gitlab.com/gitlab-org/gitlab-shell/internal/console" "gitlab.com/gitlab-org/gitlab-shell/internal/executable" "gitlab.com/gitlab-org/gitlab-shell/internal/logger" + "gitlab.com/gitlab-org/gitlab-shell/internal/sshenv" ) var ( @@ -47,7 +48,8 @@ func main() { logger.Configure(config) - cmd, err := command.New(executable, os.Args[1:], config, readWriter) + env := sshenv.NewFromEnv() + cmd, err := command.New(executable, os.Args[1:], env, config, readWriter) if err != nil { // For now this could happen if `SSH_CONNECTION` is not set on // the environment -- cgit v1.2.1