Add feature switch for enabling pure TCP socket

This commit is contained in:
Maciej Szlosarczyk 2019-05-28 11:30:01 +03:00
parent b5a7430c96
commit 1995b6263b
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 10 additions and 3 deletions

View file

@ -14,6 +14,7 @@
-export([init/1]). -export([init/1]).
-define(SERVER, ?MODULE). -define(SERVER, ?MODULE).
-define(DevMode, application:get_env(epp_proxy, dev_mode)).
-define(TCPPort, -define(TCPPort,
case application:get_env(epp_proxy, tcp_port) of case application:get_env(epp_proxy, tcp_port) of
undefined -> undefined; undefined -> undefined;
@ -56,7 +57,11 @@ init([]) ->
type => supervisor, type => supervisor,
modules => [epp_pool_supervisor], modules => [epp_pool_supervisor],
start => {epp_pool_supervisor, start_link, []}}, start => {epp_pool_supervisor, start_link, []}},
{ok, {SupFlags, [TCPAcceptor, TLSAcceptor, PoolSupervisor]}}. ChildrenSpec = case ?DevMode of
{ok, true} -> [TCPAcceptor, TLSAcceptor, PoolSupervisor];
_ -> [TLSAcceptor, PoolSupervisor]
end,
{ok, {SupFlags, ChildrenSpec}}.
%%==================================================================== %%====================================================================
%% Internal functions %% Internal functions

View file

@ -1,5 +1,6 @@
[ [
{epp_proxy, [{tcp_port, 1700}, {epp_proxy, [{dev_mode, false},
{tcp_port, 1700},
{tls_port, 700}, {tls_port, 700},
{epp_session_url, "https://registry.test/epp/session/"}, {epp_session_url, "https://registry.test/epp/session/"},
{epp_command_url, "https://registry.test/epp/command/"}, {epp_command_url, "https://registry.test/epp/command/"},

View file

@ -1,5 +1,6 @@
[ [
{epp_proxy, [{tcp_port, 3333}, {epp_proxy, [{dev_mode, false},
{tcp_port, 3333},
{tls_port, 4444}, {tls_port, 4444},
{epp_session_url, "https://registry.test/epp/session/"}, {epp_session_url, "https://registry.test/epp/session/"},
{epp_command_url, "https://registry.test/epp/command/"}, {epp_command_url, "https://registry.test/epp/command/"},