Commit cb5b39a4 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Add user information to external event contexts.

parent a0e01301
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Added
- Event contexts now contain user information for external events.

### Fixed
- Add missing 'rank' field from the Lua runtime `tournament_records_haystack` function results.

+3 −1
Original line number Diff line number Diff line
@@ -53,7 +53,9 @@ func (s *ApiServer) Event(ctx context.Context, in *api.Event) (*empty.Empty, err

	// Add event to processing queue if there are any event handlers registered.
	if fn := s.runtime.Event(); fn != nil {
		fn(ctx, in)
		clientIP, clientPort := extractClientAddressFromContext(s.logger, ctx)
		evtCtx := NewRuntimeGoContext(ctx, s.config.GetName(), s.config.GetRuntime().Environment, RuntimeExecutionModeEvent, nil, ctx.Value(ctxExpiryKey{}).(int64), ctx.Value(ctxUserIDKey{}).(uuid.UUID).String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxVarsKey{}).(map[string]string), "", clientIP, clientPort)
		fn(evtCtx, in)
	}

	// After hook.