feat(config): set the endpoint to "" to disable listener

This commit is contained in:
William Yang 2021-07-05 23:43:35 +02:00
parent 7a3330856d
commit 660d16e84b
2 changed files with 5 additions and 3 deletions

View File

@ -145,9 +145,8 @@ start_listener(Proto, ListenOn, Options) when Proto == https; Proto == wss ->
%% Start MQTT/QUIC listener
start_listener(quic, ListenOn, Options) ->
IsQuicEnabled = false == os:getenv("EMQX_NO_QUIC"),
case [ A || {quicer, _, _} = A<-application:which_applications() ] of
[_] when IsQuicEnabled ->
[_] ->
%% @fixme unsure why we need reopen lib and reopen config.
quicer_nif:open_lib(),
quicer_nif:reg_open(),

View File

@ -333,7 +333,7 @@ fields("quic_listener") ->
[ {"$name", ref("quic_listener_settings")}];
fields("listener_settings") ->
[ {"endpoint", t(union(ip_port(), integer()))}
[ {"endpoint", t(union([ip_port(), integer(), ""]))}
, {"acceptors", t(integer(), undefined, 8)}
, {"max_connections", t(integer(), undefined, 1024)}
, {"max_conn_rate", t(integer())}
@ -785,6 +785,7 @@ tr_listeners(Conf) ->
TcpListeners = fun(Type, Name) ->
Prefix = string:join(["listener", Type, Name], "."),
ListenOnN = case conf_get(Prefix ++ ".endpoint", Conf) of
"" -> [];
undefined -> [];
ListenOn -> ListenOn
end,
@ -801,6 +802,8 @@ tr_listeners(Conf) ->
SslListeners = fun(Type, Name) ->
Prefix = string:join(["listener", Type, Name], "."),
case conf_get(Prefix ++ ".endpoint", Conf) of
"" ->
[];
undefined ->
[];
ListenOn ->