From 7215126b6674abd4b5ff6b97d30bab6c544bf8df Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 21 Dec 2018 18:05:18 +0100 Subject: 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 --- go/internal/command/fallback/fallback.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 go/internal/command/fallback/fallback.go (limited to 'go/internal/command/fallback/fallback.go') 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 +} -- cgit v1.2.1