diff options
author | Igor Wiedler <iwiedler@gitlab.com> | 2020-11-17 15:22:51 +0100 |
---|---|---|
committer | Igor Wiedler <iwiedler@gitlab.com> | 2020-11-17 15:22:51 +0100 |
commit | f9384a90497bedc0002633b21076336c29a2c406 (patch) | |
tree | f9b5f76ac1ecd7ac959527665e81e6024ae07eed | |
parent | 3f9890ef73dced430d86801a1efc0e93ec50890e (diff) | |
download | gitlab-shell-f9384a90497bedc0002633b21076336c29a2c406.tar.gz |
Propagate client identity to gitaly
-rw-r--r-- | internal/handler/exec.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go index 3688336..fdf3810 100644 --- a/internal/handler/exec.go +++ b/internal/handler/exec.go @@ -69,6 +69,15 @@ 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("user_id", response.UserId) + md.Append("username", response.Username) + md.Append("remote_ip", sshenv.LocalAddr()) + ctx = metadata.NewOutgoingContext(ctx, md) + return ctx, cancel } |