aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-10-02 16:19:13 +0200
committerLoïc Hoguin <[email protected]>2017-10-02 16:19:13 +0200
commit9317751cb314328340fede4cb780562b77afe8c9 (patch)
treeab876bb3355acb0b3980b391f408ab3b50972336 /src
parent6460e9d2d270cffe2074053af224af7ce94ce098 (diff)
downloadcowboy-9317751cb314328340fede4cb780562b77afe8c9.tar.gz
cowboy-9317751cb314328340fede4cb780562b77afe8c9.tar.bz2
cowboy-9317751cb314328340fede4cb780562b77afe8c9.zip
Fix cowboy:set_env when the env value is missing
Diffstat (limited to 'src')
-rw-r--r--src/cowboy.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cowboy.erl b/src/cowboy.erl
index f01bcf4..99615de 100644
--- a/src/cowboy.erl
+++ b/src/cowboy.erl
@@ -68,6 +68,6 @@ stop_listener(Ref) ->
-spec set_env(ranch:ref(), atom(), any()) -> ok.
set_env(Ref, Name, Value) ->
Opts = ranch:get_protocol_options(Ref),
- {_, Env} = maps:find(env, Opts),
+ Env = maps:get(env, Opts, #{}),
Opts2 = maps:put(env, maps:put(Name, Value, Env), Opts),
ok = ranch:set_protocol_options(Ref, Opts2).