diff --git a/priv/emq.schema b/priv/emq.schema index 8922e1e9e..a2860322c 100644 --- a/priv/emq.schema +++ b/priv/emq.schema @@ -1021,14 +1021,32 @@ end}. end end, + ApiListeners = fun(Type, Name) -> + Prefix = string:join(["listener", Type, Name], "."), + case cuttlefish:conf_get(Prefix, Conf, undefined) of + undefined -> + []; + ListenOn -> + SslOpts1 = case SslOpts(Prefix) of + [] -> []; + SslOpts0 -> [{sslopts, SslOpts0}] + end, + [{Atom(Type), ListenOn, [{connopts, ConnOpts(Prefix)}, + {sockopts, TcpOpts(Prefix)}| LisOpts(Prefix)] ++ SslOpts1}] + end + end, + + lists:flatten([TcpListeners(Type, Name) || {["listener", Type, Name], ListenOn} <- cuttlefish_variable:filter_by_prefix("listener.tcp", Conf) ++ cuttlefish_variable:filter_by_prefix("listener.ws", Conf)] ++ [SslListeners(Type, Name) || {["listener", Type, Name], ListenOn} <- cuttlefish_variable:filter_by_prefix("listener.ssl", Conf) - ++ cuttlefish_variable:filter_by_prefix("listener.wss", Conf) - ++ cuttlefish_variable:filter_by_prefix("listener.api", Conf)]) + ++ cuttlefish_variable:filter_by_prefix("listener.wss", Conf)] + ++ + [ApiListeners(Type, Name) || {["listener", Type, Name], ListenOn} + <- cuttlefish_variable:filter_by_prefix("listener.api", Conf)]) end}. %%--------------------------------------------------------------------