Skip to content

Commit 7d92fcd

Browse files
committed
minimal patch to optional enable tls
1 parent cc4213b commit 7d92fcd

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/cowboy_bridge_modules/cowboy_simple_bridge_sup.erl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ init([]) ->
2727
{Address, Port} = simple_bridge_util:get_address_and_port(cowboy),
2828
IP = simple_bridge_util:parse_ip(Address),
2929

30-
io:format("Starting Cowboy Server on ~p:~p~n",
31-
[IP, Port]),
30+
{Schema, F, TOpts} = case simple_bridge_util:get_env(tls) of
31+
undefined -> {http, start_http, []};
32+
[_|_] = O -> {https, start_https, O}
33+
end,
34+
35+
36+
io:format("Starting Cowboy ~p Server on ~p:~p~n",
37+
[Schema, IP, Port]),
38+
3239

3340
Dispatch = generate_dispatch(),
3441
io:format("Using Cowboy Dispatch Table:~n ~p~n",[Dispatch]),
@@ -38,7 +45,7 @@ init([]) ->
3845
{max_keepalive, 100}
3946
],
4047

41-
cowboy:start_http(http, 100, [{ip, IP}, {port, Port}], Opts),
48+
cowboy:F(Schema, 100, [{ip, IP}, {port, Port}| TOpts], Opts),
4249

4350
{ok, { {one_for_one, 5, 10}, []}}.
4451

0 commit comments

Comments
 (0)