mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
make set_env working with maps.
This commit is contained in:
parent
78af194e07
commit
304e3efbf8
1 changed files with 2 additions and 3 deletions
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue