Merge pull request #1097 from emqtt/develop

Update listener.api schema
This commit is contained in:
Feng Lee 2017-06-12 21:58:55 +08:00 committed by GitHub
commit 470e76346f
1 changed files with 20 additions and 2 deletions

View File

@ -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}.
%%--------------------------------------------------------------------