summaryrefslogtreecommitdiff
path: root/go/internal/command/fallback/fallback.go
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-12-21 18:05:18 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2019-01-15 11:51:38 +0100
commit7215126b6674abd4b5ff6b97d30bab6c544bf8df (patch)
tree80afaa50573476962cd8b531678ddb8b77ae8c63 /go/internal/command/fallback/fallback.go
parent0cbbe1e3b555b3d62b2cb5a6a17c5c4992e3619d (diff)
downloadgitlab-shell-7215126b6674abd4b5ff6b97d30bab6c544bf8df.tar.gz
Allow enabling gitlab-shell "discover"-feature
This adds the possibility to enable features for GitLab shell. The first feature being recognized is "Discover": It's the command that is executed when running `ssh git@gitlab.example.com` and is called without a command. The gitlab key id or username is already parsed from the command line arguments. Currently we only support communicating with GitLab-rails using unix sockets. So features will not be enabled if the GitLab-url is using a different protocol. The url for this read from the config yaml. Pending ruby-specs have been added for the gitlab-shell command. Refactor to have separate command packages
Diffstat (limited to 'go/internal/command/fallback/fallback.go')
-rw-r--r--go/internal/command/fallback/fallback.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/go/internal/command/fallback/fallback.go b/go/internal/command/fallback/fallback.go
new file mode 100644
index 0000000..a136657
--- /dev/null
+++ b/go/internal/command/fallback/fallback.go
@@ -0,0 +1,19 @@
+package fallback
+
+import (
+ "os"
+ "path/filepath"
+ "syscall"
+)
+
+type Command struct{}
+
+var (
+ binDir = filepath.Dir(os.Args[0])
+)
+
+func (c *Command) Execute() error {
+ rubyCmd := filepath.Join(binDir, "gitlab-shell-ruby")
+ execErr := syscall.Exec(rubyCmd, os.Args, os.Environ())
+ return execErr
+}