diff options
author | Stan Hu <stanhu@gmail.com> | 2020-11-20 00:25:55 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2020-11-20 00:25:55 +0000 |
commit | 38d3ac0404c75f18e6e265bc9da53776aefb828a (patch) | |
tree | a8c92cedcf9d9c68a55eede33668144a67899c5a /internal/handler/exec.go | |
parent | d35ec21259b30a266393f86d57ba88fe71ed67fe (diff) | |
parent | 97bb3321f711a21a33d1b9e1f3975654e23660b4 (diff) | |
download | gitlab-shell-38d3ac0404c75f18e6e265bc9da53776aefb828a.tar.gz |
Merge branch 'client-identity' into 'master'
Propagate client identity to gitaly
See merge request gitlab-org/gitlab-shell!436
Diffstat (limited to 'internal/handler/exec.go')
-rw-r--r-- | internal/handler/exec.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go index 3688336..5ead63e 100644 --- a/internal/handler/exec.go +++ b/internal/handler/exec.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "strconv" "strings" log "github.com/sirupsen/logrus" @@ -69,6 +70,17 @@ func (gc *GitalyCommand) PrepareContext(ctx context.Context, repository *pb.Repo ctx = correlation.ContextWithCorrelation(ctx, response.CorrelationID) } + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { + md = metadata.New(nil) + } + md.Append("key_id", strconv.Itoa(response.KeyId)) + md.Append("key_type", response.KeyType) + md.Append("user_id", response.UserId) + md.Append("username", response.Username) + md.Append("remote_ip", sshenv.LocalAddr()) + ctx = metadata.NewOutgoingContext(ctx, md) + return ctx, cancel } |