From 304e3efbf84bcee9e2f28480da85635800949cbe Mon Sep 17 00:00:00 2001 From: Alexandre Snarskii Date: Wed, 2 Nov 2016 20:16:56 +0300 Subject: make set_env working with maps. --- src/cowboy.erl | 5 ++--- 1 file 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). -- cgit v1.2.3