Browse Source

make set_env working with maps.

Alexandre Snarskii 8 years ago
parent
commit
304e3efbf8
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/cowboy.erl

+ 2 - 3
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).