Compare commits

...

1 Commits

Author SHA1 Message Date
Shawn f3d5977538 fix(config_api): remove config APIs that already been provided by apps 2021-08-18 10:40:58 +08:00
1 changed files with 7 additions and 1 deletions

View File

@ -48,12 +48,15 @@
-define(ERR_MSG(MSG), list_to_binary(io_lib:format("~p", [MSG]))).
-define(CORE_CONFS, [node, log, alarm, zones, cluster, rpc, broker, sysmon,
emqx_dashboard, emqx_management]).
api_spec() ->
{config_apis() ++ [config_reset_api()], []}.
config_apis() ->
[config_api(ConfPath, Schema) || {ConfPath, Schema} <-
get_conf_schema(emqx_config:get([]), ?MAX_DEPTH)].
get_conf_schema(emqx_config:get([]), ?MAX_DEPTH), is_core_conf(ConfPath)].
config_api(ConfPath, Schema) ->
Path = path_join(ConfPath),
@ -193,6 +196,9 @@ path_join([P], _Sp) -> str(P);
path_join([P | Path], Sp) ->
str(P) ++ Sp ++ path_join(Path, Sp).
is_core_conf(Path) ->
lists:member(hd(Path), ?CORE_CONFS).
str(S) when is_list(S) -> S;
str(S) when is_binary(S) -> binary_to_list(S);
str(S) when is_atom(S) -> atom_to_list(S).