chore: format emqx apps
This commit is contained in:
parent
d6a9072bb0
commit
ae1b435ace
|
@ -128,7 +128,7 @@ roots(high) ->
|
||||||
{"mqtt",
|
{"mqtt",
|
||||||
sc(
|
sc(
|
||||||
ref("mqtt"),
|
ref("mqtt"),
|
||||||
#{ desc => ?DESC(mqtt)}
|
#{desc => ?DESC(mqtt)}
|
||||||
)},
|
)},
|
||||||
{?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME,
|
{?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME,
|
||||||
authentication(
|
authentication(
|
||||||
|
@ -1268,7 +1268,7 @@ fields("sys_topics") ->
|
||||||
{"sys_event_messages",
|
{"sys_event_messages",
|
||||||
sc(
|
sc(
|
||||||
ref("event_names"),
|
ref("event_names"),
|
||||||
#{ desc => ?DESC(sys_event_messages) }
|
#{desc => ?DESC(sys_event_messages)}
|
||||||
)}
|
)}
|
||||||
];
|
];
|
||||||
fields("event_names") ->
|
fields("event_names") ->
|
||||||
|
|
|
@ -322,7 +322,8 @@ delete_old_file(_New, Old) ->
|
||||||
case is_generated_file(Old) andalso filelib:is_regular(Old) andalso file:delete(Old) of
|
case is_generated_file(Old) andalso filelib:is_regular(Old) andalso file:delete(Old) of
|
||||||
ok ->
|
ok ->
|
||||||
ok;
|
ok;
|
||||||
false -> %% the file is not generated by us, or it is already deleted
|
%% the file is not generated by us, or it is already deleted
|
||||||
|
false ->
|
||||||
ok;
|
ok;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?SLOG(error, #{msg => "failed_to_delete_ssl_file", file_path => Old, reason => Reason})
|
?SLOG(error, #{msg => "failed_to_delete_ssl_file", file_path => Old, reason => Reason})
|
||||||
|
@ -412,16 +413,21 @@ pem_dir(Dir) ->
|
||||||
filename:join([emqx:mutable_certs_dir(), Dir]).
|
filename:join([emqx:mutable_certs_dir(), Dir]).
|
||||||
|
|
||||||
is_hex_str(HexStr) ->
|
is_hex_str(HexStr) ->
|
||||||
try is_hex_str2(ensure_str(HexStr))
|
try
|
||||||
catch throw: not_hex -> false
|
is_hex_str2(ensure_str(HexStr))
|
||||||
|
catch
|
||||||
|
throw:not_hex -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
is_hex_str2(HexStr) ->
|
is_hex_str2(HexStr) ->
|
||||||
_ = [case S of
|
_ = [
|
||||||
|
case S of
|
||||||
S when S >= $0, S =< $9 -> S;
|
S when S >= $0, S =< $9 -> S;
|
||||||
S when S >= $a, S =< $f -> S;
|
S when S >= $a, S =< $f -> S;
|
||||||
_ -> throw(not_hex)
|
_ -> throw(not_hex)
|
||||||
end || S <- HexStr],
|
end
|
||||||
|
|| S <- HexStr
|
||||||
|
],
|
||||||
true.
|
true.
|
||||||
|
|
||||||
hex_str(Bin) ->
|
hex_str(Bin) ->
|
||||||
|
@ -457,8 +463,7 @@ do_drop_invalid_certs([Key | Keys], SSL) ->
|
||||||
PemOrPath ->
|
PemOrPath ->
|
||||||
case is_pem(PemOrPath) orelse is_valid_pem_file(PemOrPath) of
|
case is_pem(PemOrPath) orelse is_valid_pem_file(PemOrPath) of
|
||||||
true -> do_drop_invalid_certs(Keys, SSL);
|
true -> do_drop_invalid_certs(Keys, SSL);
|
||||||
{error, _} ->
|
{error, _} -> do_drop_invalid_certs(Keys, maps:without([Key], SSL))
|
||||||
do_drop_invalid_certs(Keys, maps:without([Key], SSL))
|
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -488,8 +488,9 @@ is_tcp_server_available(Host, Port, Timeout) ->
|
||||||
start_ekka() ->
|
start_ekka() ->
|
||||||
try mnesia_hook:module_info() of
|
try mnesia_hook:module_info() of
|
||||||
_ -> ekka:start()
|
_ -> ekka:start()
|
||||||
catch _:_ ->
|
catch
|
||||||
%% Falling back to using Mnesia DB backend.
|
_:_ ->
|
||||||
application:set_env(mria, db_backend, mnesia),
|
%% Falling back to using Mnesia DB backend.
|
||||||
ekka:start()
|
application:set_env(mria, db_backend, mnesia),
|
||||||
|
ekka:start()
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -223,7 +223,9 @@ t_callback_crash(_Config) ->
|
||||||
Opts = #{rawconf_with_defaults => true},
|
Opts = #{rawconf_with_defaults => true},
|
||||||
ok = emqx_config_handler:add_handler(CrashPath, ?MODULE),
|
ok = emqx_config_handler:add_handler(CrashPath, ?MODULE),
|
||||||
Old = emqx:get_raw_config(CrashPath),
|
Old = emqx:get_raw_config(CrashPath),
|
||||||
?assertMatch({error, {config_update_crashed, _}}, emqx:update_config(CrashPath, <<"89%">>, Opts)),
|
?assertMatch(
|
||||||
|
{error, {config_update_crashed, _}}, emqx:update_config(CrashPath, <<"89%">>, Opts)
|
||||||
|
),
|
||||||
New = emqx:get_raw_config(CrashPath),
|
New = emqx:get_raw_config(CrashPath),
|
||||||
?assertEqual(Old, New),
|
?assertEqual(Old, New),
|
||||||
ok = emqx_config_handler:remove_handler(CrashPath),
|
ok = emqx_config_handler:remove_handler(CrashPath),
|
||||||
|
|
Loading…
Reference in New Issue