Commit 80835629 authored by Kim "BKC" Carlbäcker's avatar Kim "BKC" Carlbäcker

tokens!

parent 164baba2
...@@ -41,7 +41,7 @@ func execCommand(command string, args ...string) error { ...@@ -41,7 +41,7 @@ func execCommand(command string, args ...string) error {
return syscall.Exec(binPath, args, os.Environ()) return syscall.Exec(binPath, args, os.Environ())
} }
func dialOpts(token string) []grpc.DialOption { func dialOpts() []grpc.DialOption {
connOpts := client.DefaultDialOpts connOpts := client.DefaultDialOpts
if token := os.Getenv("GITALY_TOKEN"); token != "" { if token := os.Getenv("GITALY_TOKEN"); token != "" {
connOpts = append(client.DefaultDialOpts, grpc.WithPerRPCCredentials(gitalyauth.RPCCredentials(token))) connOpts = append(client.DefaultDialOpts, grpc.WithPerRPCCredentials(gitalyauth.RPCCredentials(token)))
......
...@@ -14,7 +14,7 @@ func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) (int32 ...@@ -14,7 +14,7 @@ func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) (int32
return 0, fmt.Errorf("no gitaly_address given") return 0, fmt.Errorf("no gitaly_address given")
} }
conn, err := client.Dial(gitalyAddress, dialOpts(os.Getenv("GITALY_TOKEN"))) conn, err := client.Dial(gitalyAddress, dialOpts())
if err != nil { if err != nil {
return 0, err return 0, err
} }
......
...@@ -14,7 +14,7 @@ func UploadPack(gitalyAddress string, request *pb.SSHUploadPackRequest) (int32, ...@@ -14,7 +14,7 @@ func UploadPack(gitalyAddress string, request *pb.SSHUploadPackRequest) (int32,
return 0, fmt.Errorf("no gitaly_address given") return 0, fmt.Errorf("no gitaly_address given")
} }
conn, err := client.Dial(gitalyAddress, dialOpts(os.Getenv("GITALY_TOKEN"))) conn, err := client.Dial(gitalyAddress, dialOpts())
if err != nil { if err != nil {
return 0, err return 0, err
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment