From 70507e893cc83d734a4d31b7c000c73d9a0b5aed Mon Sep 17 00:00:00 2001 From: turtled Date: Mon, 12 Jun 2017 21:54:51 +0800 Subject: [PATCH] Update listener.api schema --- priv/emq.schema | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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}. %%--------------------------------------------------------------------