1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%
{mapping, "web_mqtt.num_acceptors.tcp", "rabbitmq_web_mqtt.num_tcp_acceptors",
[{datatype, integer}]}.
{mapping, "web_mqtt.num_acceptors.ssl", "rabbitmq_web_mqtt.num_ssl_acceptors",
[{datatype, integer}]}.
{mapping, "web_mqtt.max_connections", "rabbitmq_web_mqtt.max_connections", [
{datatype, [{enum, [infinity]}, integer]}
]}.
{mapping, "web_mqtt.tcp.backlog", "rabbitmq_web_mqtt.tcp_config.backlog",
[{datatype, integer}]}.
{mapping, "web_mqtt.tcp.listener", "rabbitmq_web_mqtt.tcp_config", [
{datatype, [{enum, [none]}, ip]}
]}.
{mapping, "web_mqtt.tcp.ip", "rabbitmq_web_mqtt.tcp_config.ip",
[{datatype, string}, {validators, ["is_ip"]}]}.
{mapping, "web_mqtt.tcp.port", "rabbitmq_web_mqtt.tcp_config.port",
[{datatype, integer}]}.
{mapping, "web_mqtt.ws_path", "rabbitmq_web_mqtt.ws_path",
[{datatype, string}]}.
{translation,
"rabbitmq_web_mqtt.tcp_config",
fun(Conf) ->
Setting = cuttlefish:conf_get("web_mqtt.tcp.listener", Conf, undefined),
case Setting of
none -> [];
undefined -> [{port, 15675}];
{Ip, Port} when is_list(Ip), is_integer(Port) ->
[{ip, Ip}, {port, Port}]
end
end
}.
{mapping, "web_mqtt.ssl.listener", "rabbitmq_web_mqtt.ssl_config", [
{datatype, [{enum, [none]}, ip]}
]}.
{mapping, "web_mqtt.ssl.backlog", "rabbitmq_web_mqtt.ssl_config.backlog",
[{datatype, integer}]}.
{mapping, "web_mqtt.ssl.ip", "rabbitmq_web_mqtt.ssl_config.ip",
[{datatype, string}, {validators, ["is_ip"]}]}.
{mapping, "web_mqtt.ssl.port", "rabbitmq_web_mqtt.ssl_config.port",
[{datatype, integer}]}.
{mapping, "web_mqtt.ssl.certfile", "rabbitmq_web_mqtt.ssl_config.certfile",
[{datatype, string}, {validators, ["file_accessible"]}]}.
{mapping, "web_mqtt.ssl.keyfile", "rabbitmq_web_mqtt.ssl_config.keyfile",
[{datatype, string}, {validators, ["file_accessible"]}]}.
{mapping, "web_mqtt.ssl.cacertfile", "rabbitmq_web_mqtt.ssl_config.cacertfile",
[{datatype, string}, {validators, ["file_accessible"]}]}.
{mapping, "web_mqtt.ssl.password", "rabbitmq_web_mqtt.ssl_config.password",
[{datatype, [tagged_binary, binary]}]}.
{translation,
"rabbitmq_web_mqtt.ssl_config",
fun(Conf) ->
Setting = cuttlefish:conf_get("web_mqtt.ssl.listener", Conf, undefined),
case Setting of
none -> cuttlefish:unset();
undefined -> [];
{Ip, Port} when is_list(Ip), is_integer(Port) ->
%% we redo some of Cuttlefish's work here to
%% populate rabbitmq_web_mqtt.ssl_config here
TLSConf = cuttlefish_variable:filter_by_prefix("web_mqtt.ssl", Conf),
%% preserve all web_mqtt.ssl.* keys in rabbitmq_web_mqtt.ssl_config
TLSConfM0 = maps:fold(fun(Path, V, Acc) ->
maps:put(list_to_atom(lists:last(Path)), V, Acc)
end, #{}, maps:from_list(TLSConf)),
TLSConfM = maps:remove(listener, TLSConfM0),
ListenerM = maps:from_list([{ip, Ip}, {port, Port}]),
lists:keysort(1, maps:to_list(maps:merge(TLSConfM, ListenerM)));
_ -> Setting
end
end
}.
{mapping, "web_mqtt.ssl.honor_cipher_order", "rabbitmq_web_mqtt.ssl_config.honor_cipher_order",
[{datatype, {enum, [true, false]}}]}.
{mapping, "web_mqtt.ssl.honor_ecc_order", "rabbitmq_web_mqtt.ssl_config.honor_ecc_order",
[{datatype, {enum, [true, false]}}]}.
{mapping, "web_mqtt.ssl.reuse_sessions", "rabbitmq_web_mqtt.ssl_config.reuse_sessions",
[{datatype, {enum, [true, false]}}]}.
{mapping, "web_mqtt.ssl.secure_renegotiate", "rabbitmq_web_mqtt.ssl_config.secure_renegotiate",
[{datatype, {enum, [true, false]}}]}.
{mapping, "web_mqtt.ssl.client_renegotiation", "rabbitmq_web_mqtt.ssl_config.client_renegotiation",
[{datatype, {enum, [true, false]}}]}.
{mapping, "web_mqtt.ssl.crl_check", "rabbitmq_web_mqtt.ssl_config.crl_check",
[{datatype, [{enum, [true, false, peer, best_effort]}]}]}.
{mapping, "web_mqtt.ssl.depth", "rabbitmq_web_mqtt.ssl_config.depth",
[{datatype, integer}, {validators, ["byte"]}]}.
{mapping, "web_mqtt.ssl.versions.$version", "rabbitmq_web_mqtt.ssl_config.versions",
[{datatype, atom}]}.
{translation, "rabbitmq_web_mqtt.ssl_config.versions",
fun(Conf) ->
Settings = cuttlefish_variable:filter_by_prefix("web_mqtt.ssl.versions", Conf),
[V || {_, V} <- Settings]
end}.
{mapping, "web_mqtt.ssl.ciphers.$cipher", "rabbitmq_web_mqtt.ssl_config.ciphers",
[{datatype, string}]}.
{translation, "rabbitmq_web_mqtt.ssl_config.ciphers",
fun(Conf) ->
Settings = cuttlefish_variable:filter_by_prefix("web_mqtt.ssl.ciphers", Conf),
lists:reverse([V || {_, V} <- Settings])
end}.
%%
%% Cowboy options
%%
{mapping, "web_mqtt.cowboy_opts.max_empty_lines", "rabbitmq_web_mqtt.cowboy_opts.max_empty_lines",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.max_header_name_length", "rabbitmq_web_mqtt.cowboy_opts.max_header_name_length",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.max_header_value_length", "rabbitmq_web_mqtt.cowboy_opts.max_header_value_length",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.max_headers", "rabbitmq_web_mqtt.cowboy_opts.max_headers",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.max_keepalive", "rabbitmq_web_mqtt.cowboy_opts.max_keepalive",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.max_request_line_length", "rabbitmq_web_mqtt.cowboy_opts.max_request_line_length",
[{datatype, integer}]}.
{mapping, "web_mqtt.cowboy_opts.timeout", "rabbitmq_web_mqtt.cowboy_opts.idle_timeout",
[{datatype, integer}]}.
%% backwards compatibility
{mapping, "web_mqtt.cowboy_opts.timeout", "rabbitmq_web_mqtt.cowboy_opts.idle_timeout",
[{datatype, integer}, {validators, ["non_negative_integer"]}]
}.
%% recent Cowboy versions have several timeout settings
{mapping, "web_mqtt.cowboy_opts.idle_timeout", "rabbitmq_web_mqtt.cowboy_opts.idle_timeout",
[{datatype, integer}]
}.
{translation,
"rabbitmq_web_mqtt.cowboy_opts.idle_timeout",
fun(Conf) ->
case cuttlefish:conf_get("web_mqtt.cowboy_opts.timeout", Conf, undefined) of
Value when is_integer(Value) ->
Value;
undefined ->
case cuttlefish:conf_get("web_mqtt.cowboy_opts.idle_timeout", Conf, undefined) of
undefined -> cuttlefish:unset();
Value -> Value
end
end
end
}.
{mapping, "web_mqtt.ws_opts.compress", "rabbitmq_web_mqtt.cowboy_ws_opts.compress",
[{datatype, {enum, [true, false]}}]
}.
{mapping, "web_mqtt.ws_opts.max_frame_size", "rabbitmq_web_mqtt.cowboy_ws_opts.max_frame_size",
[{datatype, integer}, {validators, ["non_negative_integer"]}]
}.
{mapping, "web_mqtt.ws_opts.idle_timeout", "rabbitmq_web_mqtt.cowboy_ws_opts.idle_timeout",
[{datatype, integer}, {validators, ["non_negative_integer"]}]
}.
%% Whether or not to enable proxy protocol support.
%%
%% {proxy_protocol, false}
{mapping, "web_mqtt.proxy_protocol", "rabbitmq_web_mqtt.proxy_protocol",
[{datatype, {enum, [true, false]}}]}.
%%
%% File Handle Cache
%%
{mapping, "web_mqtt.use_file_handle_cache", "rabbitmq_web_mqtt.use_file_handle_cache",
[
{datatype, {enum, [true, false]}}
]}.
|