Unverified Commit 419be0da authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Expose http headers to rpc calls context (#712)

parent 17a68fc4
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
- Add ctx field to access http request headers in the runtimes.

### Fixed
- Gracefully close Lua matches when call queue fills up.
- Better handling for Lua runtime wallet update operation errors.
+4 −0
Original line number Diff line number Diff line
@@ -4713,6 +4713,10 @@
        "environment": {
          "$ref": "#/definitions/ValidatedPurchaseEnvironment",
          "description": "Whether the purchase was done in production or sandbox environment."
        },
        "seenBefore": {
          "type": "boolean",
          "description": "Whether the purchase had already been validated by Nakama before."
        }
      },
      "description": "Validated Purchase stored by Nakama."
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ require (
	github.com/gorilla/mux v1.8.0
	github.com/gorilla/websocket v1.4.2
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0
	github.com/heroiclabs/nakama-common v1.20.0
	github.com/heroiclabs/nakama-common v1.20.1-0.20211129154918-e47c06d002f1
	github.com/jackc/pgconn v1.10.0
	github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451
	github.com/jackc/pgtype v1.8.1
+2 −5
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulN
github.com/blevesearch/vellum v1.0.5/go.mod h1:atE0EH3fvk43zzS7t1YNdNC7DbmcC3uz+eMD5xZ2OyQ=
github.com/blevesearch/vellum v1.0.7 h1:+vn8rfyCRHxKVRgDLeR0FAXej2+6mEb5Q15aQE/XESQ=
github.com/blevesearch/vellum v1.0.7/go.mod h1:doBZpmRhwTsASB4QdUZANlJvqVAUdUyX0ZK7QJCTeBE=
github.com/blugelabs/bluge v0.1.7 h1:CIP3OlzWZ46GbqyIdxXIeLgcSRkCopFIcn81I4T+QG8=
github.com/blugelabs/bluge v0.1.7/go.mod h1:5d7LktUkQgvbh5Bmi6tPWtvo4+6uRTm6gAwP+5z6FqQ=
github.com/blugelabs/bluge v0.1.8 h1:80O2EhbAlNykvPGA0SgHc7/9oKi1Xh/g0uk/4/9tksE=
github.com/blugelabs/bluge v0.1.8/go.mod h1:5d7LktUkQgvbh5Bmi6tPWtvo4+6uRTm6gAwP+5z6FqQ=
@@ -86,8 +85,6 @@ github.com/blugelabs/bluge_segment_api v0.2.0 h1:cCX1Y2y8v0LZ7+EEJ6gH7dW6TtVTW4R
github.com/blugelabs/bluge_segment_api v0.2.0/go.mod h1:95XA+ZXfRj/IXADm7gZ+iTcWOJPg5jQTY1EReIzl3LA=
github.com/blugelabs/ice v0.2.0 h1:9N/TRBqAr43emheD1ptk9mohuT6xAVq83gesgE60Qqk=
github.com/blugelabs/ice v0.2.0/go.mod h1:7foiDf4V83FIYYnGh2LOoRWsbNoCqAAMNgKn879Iyu0=
github.com/blugelabs/query_string v0.2.0 h1:ITgD9zF7HQiXstJgRZ+W4kWYUUKJNjhwwRXUtwX6WZs=
github.com/blugelabs/query_string v0.2.0/go.mod h1:H0YFWhYAf8/xcv1zoswoUC8kM/fE9L/KEfsgySsnhfs=
github.com/blugelabs/query_string v0.3.0 h1:/2XMd/3A0lIo33STXMUon4khLcTTybrAcyC0mBLmeA8=
github.com/blugelabs/query_string v0.3.0/go.mod h1:H0YFWhYAf8/xcv1zoswoUC8kM/fE9L/KEfsgySsnhfs=
github.com/cactus/go-statsd-client v3.1.1+incompatible/go.mod h1:cMRcwZDklk7hXp+Law83urTHUiHMzCev/r4JMYr/zU0=
@@ -254,8 +251,8 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/heroiclabs/nakama-common v1.20.0 h1:5tgLPp/1G16xouwpegTVI7u9T1EWBn4vYwLIV7Do7jU=
github.com/heroiclabs/nakama-common v1.20.0/go.mod h1:jzIGV5bI45ALRQFzHPkJn4Z0tV+xhtho1+pZhOXVAsk=
github.com/heroiclabs/nakama-common v1.20.1-0.20211129154918-e47c06d002f1 h1:gR09lWLv/v3gMoLWijNlk6ua12rdnyzGIWuC5Ua9+gc=
github.com/heroiclabs/nakama-common v1.20.1-0.20211129154918-e47c06d002f1/go.mod h1:WF4YG46afwY3ibzsXnkt3zvhQ3tBY03IYeU7xSLr8HE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ func (s *ApiServer) Event(ctx context.Context, in *api.Event) (*emptypb.Empty, e
	// Add event to processing queue if there are any event handlers registered.
	if fn := s.runtime.Event(); fn != nil {
		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, "")
		evtCtx := NewRuntimeGoContext(ctx, s.config.GetName(), s.config.GetRuntime().Environment, RuntimeExecutionModeEvent, nil, 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)
	}

Loading