feat: deprecated dashboard.listeners.name.enable
This commit is contained in:
parent
267053cc35
commit
4b82d4d927
|
@ -145,7 +145,9 @@ apps() ->
|
||||||
listeners(Listeners) ->
|
listeners(Listeners) ->
|
||||||
lists:filtermap(
|
lists:filtermap(
|
||||||
fun
|
fun
|
||||||
({Protocol, Conf = #{enable := true}}) ->
|
({_Protocol, #{bind := 0}}) ->
|
||||||
|
false;
|
||||||
|
({Protocol, Conf = #{}}) ->
|
||||||
{Conf1, Bind} = ip_port(Conf),
|
{Conf1, Bind} = ip_port(Conf),
|
||||||
{true, {
|
{true, {
|
||||||
listener_name(Protocol),
|
listener_name(Protocol),
|
||||||
|
@ -153,9 +155,7 @@ listeners(Listeners) ->
|
||||||
Bind,
|
Bind,
|
||||||
ranch_opts(Conf1),
|
ranch_opts(Conf1),
|
||||||
proto_opts(Conf1)
|
proto_opts(Conf1)
|
||||||
}};
|
}}
|
||||||
({_Protocol, #{enable := false}}) ->
|
|
||||||
false
|
|
||||||
end,
|
end,
|
||||||
maps:to_list(Listeners)
|
maps:to_list(Listeners)
|
||||||
).
|
).
|
||||||
|
@ -182,7 +182,7 @@ ranch_opts(Options) ->
|
||||||
SocketOpts = maps:fold(
|
SocketOpts = maps:fold(
|
||||||
fun filter_false/3,
|
fun filter_false/3,
|
||||||
[],
|
[],
|
||||||
maps:without([enable, inet6, ipv6_v6only, proxy_header | Keys], Options)
|
maps:without([inet6, ipv6_v6only, proxy_header | Keys], Options)
|
||||||
),
|
),
|
||||||
InetOpts =
|
InetOpts =
|
||||||
case Options of
|
case Options of
|
||||||
|
|
|
@ -174,7 +174,9 @@ diff_listeners(Type, Stop, Start) -> {#{Type => Stop}, #{Type => Start}}.
|
||||||
|
|
||||||
-define(DIR, <<"dashboard">>).
|
-define(DIR, <<"dashboard">>).
|
||||||
|
|
||||||
ensure_ssl_cert(#{<<"listeners">> := #{<<"https">> := #{<<"enable">> := true}}} = Conf) ->
|
ensure_ssl_cert(#{<<"listeners">> := #{<<"https">> := #{<<"bind">> := Bind}}} = Conf) when
|
||||||
|
Bind =/= 0
|
||||||
|
->
|
||||||
Https = emqx_utils_maps:deep_get([<<"listeners">>, <<"https">>], Conf, undefined),
|
Https = emqx_utils_maps:deep_get([<<"listeners">>, <<"https">>], Conf, undefined),
|
||||||
Opts = #{required_keys => [[<<"keyfile">>], [<<"certfile">>], [<<"cacertfile">>]]},
|
Opts = #{required_keys => [[<<"keyfile">>], [<<"certfile">>], [<<"cacertfile">>]]},
|
||||||
case emqx_tls_lib:ensure_ssl_files(?DIR, Https, Opts) of
|
case emqx_tls_lib:ensure_ssl_files(?DIR, Https, Opts) of
|
||||||
|
|
|
@ -119,7 +119,8 @@ common_listener_fields() ->
|
||||||
integer(),
|
integer(),
|
||||||
#{
|
#{
|
||||||
default => erlang:system_info(schedulers_online),
|
default => erlang:system_info(schedulers_online),
|
||||||
desc => ?DESC(num_acceptors)
|
desc => ?DESC(num_acceptors),
|
||||||
|
importance => ?IMPORTANCE_MEDIUM
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"max_connections",
|
{"max_connections",
|
||||||
|
@ -127,7 +128,8 @@ common_listener_fields() ->
|
||||||
integer(),
|
integer(),
|
||||||
#{
|
#{
|
||||||
default => 512,
|
default => 512,
|
||||||
desc => ?DESC(max_connections)
|
desc => ?DESC(max_connections),
|
||||||
|
importance => ?IMPORTANCE_HIGH
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"backlog",
|
{"backlog",
|
||||||
|
@ -135,7 +137,8 @@ common_listener_fields() ->
|
||||||
integer(),
|
integer(),
|
||||||
#{
|
#{
|
||||||
default => 1024,
|
default => 1024,
|
||||||
desc => ?DESC(backlog)
|
desc => ?DESC(backlog),
|
||||||
|
importance => ?IMPORTANCE_LOW
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"send_timeout",
|
{"send_timeout",
|
||||||
|
@ -143,7 +146,8 @@ common_listener_fields() ->
|
||||||
emqx_schema:duration(),
|
emqx_schema:duration(),
|
||||||
#{
|
#{
|
||||||
default => <<"10s">>,
|
default => <<"10s">>,
|
||||||
desc => ?DESC(send_timeout)
|
desc => ?DESC(send_timeout),
|
||||||
|
importance => ?IMPORTANCE_LOW
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"inet6",
|
{"inet6",
|
||||||
|
@ -151,7 +155,8 @@ common_listener_fields() ->
|
||||||
boolean(),
|
boolean(),
|
||||||
#{
|
#{
|
||||||
default => false,
|
default => false,
|
||||||
desc => ?DESC(inet6)
|
desc => ?DESC(inet6),
|
||||||
|
importance => ?IMPORTANCE_LOW
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"ipv6_v6only",
|
{"ipv6_v6only",
|
||||||
|
@ -159,7 +164,8 @@ common_listener_fields() ->
|
||||||
boolean(),
|
boolean(),
|
||||||
#{
|
#{
|
||||||
default => false,
|
default => false,
|
||||||
desc => ?DESC(ipv6_v6only)
|
desc => ?DESC(ipv6_v6only),
|
||||||
|
importance => ?IMPORTANCE_LOW
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"proxy_header",
|
{"proxy_header",
|
||||||
|
@ -167,7 +173,8 @@ common_listener_fields() ->
|
||||||
boolean(),
|
boolean(),
|
||||||
#{
|
#{
|
||||||
desc => ?DESC(proxy_header),
|
desc => ?DESC(proxy_header),
|
||||||
default => false
|
default => false,
|
||||||
|
importance => ?IMPORTANCE_MEDIUM
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
@ -178,7 +185,9 @@ enable(Bool) ->
|
||||||
boolean(),
|
boolean(),
|
||||||
#{
|
#{
|
||||||
default => Bool,
|
default => Bool,
|
||||||
required => true,
|
required => false,
|
||||||
|
deprecated => {since, "5.1.0"},
|
||||||
|
importance => ?IMPORTANCE_HIDDEN,
|
||||||
desc => ?DESC(listener_enable)
|
desc => ?DESC(listener_enable)
|
||||||
}
|
}
|
||||||
)}.
|
)}.
|
||||||
|
@ -188,9 +197,10 @@ bind(Port) ->
|
||||||
?HOCON(
|
?HOCON(
|
||||||
?UNION([non_neg_integer(), emqx_schema:ip_port()]),
|
?UNION([non_neg_integer(), emqx_schema:ip_port()]),
|
||||||
#{
|
#{
|
||||||
default => Port,
|
default => 0,
|
||||||
required => true,
|
required => false,
|
||||||
example => "0.0.0.0:" ++ integer_to_list(Port),
|
example => "0.0.0.0:" ++ integer_to_list(Port),
|
||||||
|
importance => ?IMPORTANCE_HIGH,
|
||||||
desc => ?DESC(bind)
|
desc => ?DESC(bind)
|
||||||
}
|
}
|
||||||
)}.
|
)}.
|
||||||
|
|
|
@ -48,7 +48,6 @@ set_default_config(DefaultUsername, HAProxyEnabled, Opts) ->
|
||||||
Config = #{
|
Config = #{
|
||||||
listeners => #{
|
listeners => #{
|
||||||
http => #{
|
http => #{
|
||||||
enable => true,
|
|
||||||
bind => maps:get(bind, Opts, 18083),
|
bind => maps:get(bind, Opts, 18083),
|
||||||
inet6 => false,
|
inet6 => false,
|
||||||
ipv6_v6only => false,
|
ipv6_v6only => false,
|
||||||
|
|
|
@ -49,8 +49,8 @@ t_update_conf(_Config) ->
|
||||||
Conf = #{
|
Conf = #{
|
||||||
dashboard => #{
|
dashboard => #{
|
||||||
listeners => #{
|
listeners => #{
|
||||||
https => #{bind => 18084, enable => true},
|
https => #{bind => 18084},
|
||||||
http => #{bind => 18083, enable => true}
|
http => #{bind => 18083}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -68,7 +68,7 @@ t_update_conf(_Config) ->
|
||||||
?check_trace(
|
?check_trace(
|
||||||
begin
|
begin
|
||||||
Raw1 = emqx_utils_maps:deep_put(
|
Raw1 = emqx_utils_maps:deep_put(
|
||||||
[<<"listeners">>, <<"https">>, <<"enable">>], Raw, false
|
[<<"listeners">>, <<"https">>, <<"bind">>], Raw, 0
|
||||||
),
|
),
|
||||||
?assertMatch({ok, _}, emqx:update_config([<<"dashboard">>], Raw1)),
|
?assertMatch({ok, _}, emqx:update_config([<<"dashboard">>], Raw1)),
|
||||||
?assertEqual(Raw1, emqx:get_raw_config([<<"dashboard">>])),
|
?assertEqual(Raw1, emqx:get_raw_config([<<"dashboard">>])),
|
||||||
|
@ -116,7 +116,7 @@ t_update_conf(_Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_management]).
|
emqx_mgmt_api_test_util:end_suite([emqx_management]).
|
||||||
|
|
||||||
t_default_ssl_cert(_Config) ->
|
t_default_ssl_cert(_Config) ->
|
||||||
Conf = #{dashboard => #{listeners => #{https => #{bind => 18084, enable => true}}}},
|
Conf = #{dashboard => #{listeners => #{https => #{bind => 18084}}}},
|
||||||
validate_https(Conf, 512, default_ssl_cert(), verify_none),
|
validate_https(Conf, 512, default_ssl_cert(), verify_none),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ t_normal_ssl_cert(_Config) ->
|
||||||
listeners => #{
|
listeners => #{
|
||||||
https => #{
|
https => #{
|
||||||
bind => 18084,
|
bind => 18084,
|
||||||
enable => true,
|
|
||||||
cacertfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/cacert.pem">>),
|
cacertfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/cacert.pem">>),
|
||||||
certfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/cert.pem">>),
|
certfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/cert.pem">>),
|
||||||
keyfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/key.pem">>),
|
keyfile => naive_env_interpolation(<<"${EMQX_ETC_DIR}/certs/key.pem">>),
|
||||||
|
@ -149,7 +148,6 @@ t_verify_cacertfile(_Config) ->
|
||||||
listeners => #{
|
listeners => #{
|
||||||
https => #{
|
https => #{
|
||||||
bind => 18084,
|
bind => 18084,
|
||||||
enable => true,
|
|
||||||
cacertfile => <<"">>,
|
cacertfile => <<"">>,
|
||||||
max_connections => MaxConnection
|
max_connections => MaxConnection
|
||||||
}
|
}
|
||||||
|
@ -180,7 +178,6 @@ t_bad_certfile(_Config) ->
|
||||||
listeners => #{
|
listeners => #{
|
||||||
https => #{
|
https => #{
|
||||||
bind => 18084,
|
bind => 18084,
|
||||||
enable => true,
|
|
||||||
certfile => <<"${EMQX_ETC_DIR}/certs/not_found_cert.pem">>
|
certfile => <<"${EMQX_ETC_DIR}/certs/not_found_cert.pem">>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue