Make the ip address type configurable.

We want to be able to use both IPv4 and IPv6.
main
absc 2024-08-02 23:15:28 +02:00
parent dbf5371122
commit f1ad05f789
1 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,12 @@ start(_Type, StartArgs) ->
undefined -> undefined undefined -> undefined
end, end,
Inet = case application:get_env(inet) of
ipv4 -> inet;
undefined -> inet;
ipv6 -> inet6
end,
{ok, Port} = application:get_env(port), {ok, Port} = application:get_env(port),
Dispatch = cowboy_router:compile([ Dispatch = cowboy_router:compile([
@ -38,6 +44,7 @@ start(_Type, StartArgs) ->
{ok, ListenerPid} = cowboy:start_tls(dudeswave_listener, [ {ok, ListenerPid} = cowboy:start_tls(dudeswave_listener, [
{port, Port}, {port, Port},
Inet,
{ip, Addr} {ip, Addr}
], #{env => #{dispatch => Dispatch}}), ], #{env => #{dispatch => Dispatch}}),