-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context #35
Comments
I support the idea of a modifiable context. Using ctx or similar as a layer of abstraction seems sound too, so it would be easier to patch for different scenarios, e.g. using some underlying structure other than maps. I'm very fond of the way Ring works in Clojure, and their requests and responses are basically extensible maps as you describe above, with certain expectations outlined in the spec. As needed we could probably use Dialyzer to "enforce" those expectations on a per-library basis too. |
But I don't know how we would do this without breaking backwards compatibility and being forced on those who just want to keep using the |
Hm, was just thinking I'd do it as an alternative to |
Or not exactly... |
could we use a preprocessor directive to determine if we should use |
I'm nearly done implementing that in a branch. |
See #44 for progress. |
Closing in favor of #70 |
Currently there is only the pdict as a way to track the context of a request (requestid, trace and span ids, etc) through middlewares to handlers.
I see two possibilities for expanding this, one which would be a major change to the elli interface and require a major version bump and the other being a simpler extension but feels sort of hacky.
The major change option would be to pass a context that is modifiable, like a map, by the middlewares. I've been starting on a lib for this: https://github.com/tsloughter/ctx
Alternatively the
req
could have a map orctx
added to it.The advantage of using a context map as the request instead of
req
is it can be used and extended by other Erlang apps and code without depending on the Elli req record.The text was updated successfully, but these errors were encountered: