summaryrefslogtreecommitdiff
path: root/go/internal/handler/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/internal/handler/handler.go')
-rw-r--r--go/internal/handler/handler.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/go/internal/handler/handler.go b/go/internal/handler/handler.go
index 927998d..f6b3c44 100644
--- a/go/internal/handler/handler.go
+++ b/go/internal/handler/handler.go
@@ -5,6 +5,10 @@ import (
"os/exec"
"syscall"
+ "google.golang.org/grpc"
+
+ "gitlab.com/gitlab-org/gitaly/auth"
+ "gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/logger"
)
@@ -36,3 +40,12 @@ func execCommand(command string, args ...string) error {
args = append([]string{binPath}, args...)
return syscall.Exec(binPath, args, os.Environ())
}
+
+func dialOpts(token string) []grpc.DialOption {
+ connOpts := client.DefaultDialOpts
+ if token := os.Getenv("GITALY_TOKEN"); token != "" {
+ connOpts = append(client.DefaultDialOpts, grpc.WithPerRPCCredentials(gitalyauth.RPCCredentials(token)))
+ }
+
+ return connOpts
+}