aboutsummaryrefslogtreecommitdiffstats
path: root/guide
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-02-20 12:14:21 +0100
committerLoïc Hoguin <[email protected]>2013-02-20 12:14:21 +0100
commitb2ffff9bec7f9d137ab5abdc3b77203914b5ae63 (patch)
treea4d22508071427e25546068b81db620dcb3a52f9 /guide
parent76b5cfea3f4a755b31a95b24176afeb87adaf442 (diff)
downloadcowboy-b2ffff9bec7f9d137ab5abdc3b77203914b5ae63.tar.gz
cowboy-b2ffff9bec7f9d137ab5abdc3b77203914b5ae63.tar.bz2
cowboy-b2ffff9bec7f9d137ab5abdc3b77203914b5ae63.zip
Add cowboy:set_env/3
Diffstat (limited to 'guide')
-rw-r--r--guide/middlewares.md3
-rw-r--r--guide/routing.md14
-rw-r--r--guide/toc.md7
3 files changed, 21 insertions, 3 deletions
diff --git a/guide/middlewares.md b/guide/middlewares.md
index 0ab6dc2..b5f055c 100644
--- a/guide/middlewares.md
+++ b/guide/middlewares.md
@@ -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
------------------
diff --git a/guide/routing.md b/guide/routing.md
index ebf34de..3f71654 100644
--- a/guide/routing.md
+++ b/guide/routing.md
@@ -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.
diff --git a/guide/toc.md b/guide/toc.md
index 2f8fa36..2f0d914 100644
--- a/guide/toc.md
+++ b/guide/toc.md
@@ -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