mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 05:00:24 +00:00
Add cowboy:set_env/3
This commit is contained in:
parent
76b5cfea3f
commit
b2ffff9bec
5 changed files with 63 additions and 4 deletions
|
@ -58,6 +58,9 @@ will not process any subsequent requests on this connection.
|
|||
The middlewares that come with Cowboy may define or require other
|
||||
environment values to perform.
|
||||
|
||||
You can update the environment by calling the `cowboy:set_env/3`
|
||||
convenience function, adding or replacing a value in the environment.
|
||||
|
||||
Routing middleware
|
||||
------------------
|
||||
|
||||
|
|
|
@ -242,3 +242,17 @@ cowboy:start_http(my_http_listener, 100,
|
|||
|
||||
Note that this function will return `{error, badarg}` if the structure
|
||||
given is incorrect.
|
||||
|
||||
Live update
|
||||
-----------
|
||||
|
||||
You can use the `cowboy:set_env/3` function for updating the dispatch
|
||||
list used by routing. This will apply to all new connections accepted
|
||||
by the listener.
|
||||
|
||||
``` erlang
|
||||
cowboy:set_env(my_http_listener, dispatch,
|
||||
cowboy_router:compile(Dispatch)).
|
||||
```
|
||||
|
||||
Note that you need to compile the routes before updating.
|
||||
|
|
|
@ -8,10 +8,11 @@ Cowboy User Guide
|
|||
* Getting started
|
||||
* [Routing](routing.md)
|
||||
* Purpose
|
||||
* Dispatch list
|
||||
* Match rules
|
||||
* Bindings
|
||||
* Structure
|
||||
* Match syntax
|
||||
* Constraints
|
||||
* Compilation
|
||||
* Live update
|
||||
* [Handlers](handlers.md)
|
||||
* Purpose
|
||||
* Protocol upgrades
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue