aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cowboy.erl5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cowboy.erl b/src/cowboy.erl
index 56aef34..e4705b6 100644
--- a/src/cowboy.erl
+++ b/src/cowboy.erl
@@ -72,7 +72,6 @@ stop_listener(Ref) ->
-spec set_env(ranch:ref(), atom(), any()) -> ok.
set_env(Ref, Name, Value) ->
Opts = ranch:get_protocol_options(Ref),
- {_, Env} = lists:keyfind(env, 1, Opts),
- Opts2 = lists:keyreplace(env, 1, Opts,
- {env, lists:keystore(Name, 1, Env, {Name, Value})}),
+ {_, Env} = maps:find(env, Opts),
+ Opts2 = maps:put(env, maps:put(Name, Value, Env), Opts),
ok = ranch:set_protocol_options(Ref, Opts2).