Skip to content

Commit

Permalink
make set_env working with maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
snar authored and essen committed May 7, 2017
1 parent 78af194 commit 304e3ef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cowboy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).

0 comments on commit 304e3ef

Please sign in to comment.