summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLucas Charles <me@lucascharles.me>2021-02-17 13:49:46 -0800
committerLucas Charles <me@lucascharles.me>2021-03-15 13:47:11 -0700
commitd539068dc372e46d10adee89e9b96b59156a2bb6 (patch)
tree9c37f5ade4a95622b30a7a47befcb46b185b9682 /cmd
parente79f115d93a9f00f3e4f8a22ec770fdf4c3e1947 (diff)
downloadgitlab-shell-d539068dc372e46d10adee89e9b96b59156a2bb6.tar.gz
chore: Refactor env introspection to rely on command initialization496-move-env-introspection-to-sshenv
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
Diffstat (limited to 'cmd')
-rw-r--r--cmd/check/main.go3
-rw-r--r--cmd/gitlab-shell-authorized-keys-check/main.go3
-rw-r--r--cmd/gitlab-shell-authorized-principals-check/main.go3
-rw-r--r--cmd/gitlab-shell/main.go4
4 files changed, 9 insertions, 4 deletions
diff --git a/cmd/check/main.go b/cmd/check/main.go
index b87e87e..fbb520b 100644
--- a/cmd/check/main.go
+++ b/cmd/check/main.go
@@ -9,6 +9,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/executable"
"gitlab.com/gitlab-org/gitlab-shell/internal/logger"
+ "gitlab.com/gitlab-org/gitlab-shell/internal/sshenv"
)
func main() {
@@ -32,7 +33,7 @@ func main() {
logger.Configure(config)
- cmd, err := command.New(executable, os.Args[1:], config, readWriter)
+ cmd, err := command.New(executable, os.Args[1:], sshenv.Env{}, config, readWriter)
if err != nil {
fmt.Fprintf(readWriter.ErrOut, "%v\n", err)
os.Exit(1)
diff --git a/cmd/gitlab-shell-authorized-keys-check/main.go b/cmd/gitlab-shell-authorized-keys-check/main.go
index ba8ddd8..8746353 100644
--- a/cmd/gitlab-shell-authorized-keys-check/main.go
+++ b/cmd/gitlab-shell-authorized-keys-check/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"
)
func main() {
@@ -33,7 +34,7 @@ func main() {
logger.Configure(config)
- cmd, err := command.New(executable, os.Args[1:], config, readWriter)
+ cmd, err := command.New(executable, os.Args[1:], sshenv.Env{}, config, readWriter)
if err != nil {
// For now this could happen if `SSH_CONNECTION` is not set on
// the environment
diff --git a/cmd/gitlab-shell-authorized-principals-check/main.go b/cmd/gitlab-shell-authorized-principals-check/main.go
index 412447d..f14fbde 100644
--- a/cmd/gitlab-shell-authorized-principals-check/main.go
+++ b/cmd/gitlab-shell-authorized-principals-check/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"
)
func main() {
@@ -33,7 +34,7 @@ func main() {
logger.Configure(config)
- cmd, err := command.New(executable, os.Args[1:], config, readWriter)
+ cmd, err := command.New(executable, os.Args[1:], sshenv.Env{}, config, readWriter)
if err != nil {
// For now this could happen if `SSH_CONNECTION` is not set on
// the environment
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