fix: replace local ref by remote ref

This commit is contained in:
Zhongwen Deng 2022-03-04 09:13:56 +08:00
parent 71d20d153b
commit e2f386383d
7 changed files with 12 additions and 12 deletions

View File

@ -35,7 +35,7 @@
%% Hocon Schema %% Hocon Schema
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
roots() -> [{config, #{type => hoconsc:union([hoconsc:ref(type1), hoconsc:ref(type2)])}}]. roots() -> [{config, #{type => hoconsc:union([hoconsc:ref(?MODULE, type1), hoconsc:ref(?MODULE, type2)])}}].
fields(type1) -> fields(type1) ->
[ {mechanism, {enum, ['password-based']}} [ {mechanism, {enum, ['password-based']}}

View File

@ -101,7 +101,7 @@ t_root_key_update(_Config) ->
?assertEqual("81%", emqx:get_raw_config(SubKey)), ?assertEqual("81%", emqx:get_raw_config(SubKey)),
%% remove %% remove
?assertEqual({error, "remove_root_is_forbidden"}, emqx:remove_config(PathKey)), ?assertEqual({error, "remove_root_is_forbidden"}, emqx:remove_config(PathKey)),
?assertMatch(#{<<"os">> := _, <<"vm">> := _ }, emqx:get_raw_config(PathKey)), ?assertMatch(true, is_map(emqx:get_raw_config(PathKey))),
ok = emqx_config_handler:remove_handler(PathKey), ok = emqx_config_handler:remove_handler(PathKey),
ok. ok.
@ -213,9 +213,9 @@ t_get_raw_cluster_override_conf(_Config) ->
ok. ok.
t_save_config_failed(_Config) -> t_save_config_failed(_Config) ->
ok. ok.
pre_config_update([sysmon], UpdateReq, RawConf) -> pre_config_update([sysmon], UpdateReq, RawConf) ->
{ok, emqx_map_lib:deep_merge(RawConf, UpdateReq)}; {ok, emqx_map_lib:deep_merge(RawConf, UpdateReq)};
pre_config_update([sysmon, os], UpdateReq, _RawConf) -> pre_config_update([sysmon, os], UpdateReq, _RawConf) ->

View File

@ -19,7 +19,7 @@
-include_lib("typerefl/include/types.hrl"). -include_lib("typerefl/include/types.hrl").
-include_lib("emqx_connector/include/emqx_connector.hrl"). -include_lib("emqx_connector/include/emqx_connector.hrl").
-import(hoconsc, [mk/2, ref/1, ref/2, array/1, enum/1]). -import(hoconsc, [mk/2, enum/1]).
-import(emqx_schema, [mk_duration/2]). -import(emqx_schema, [mk_duration/2]).
-export([fields/1, authz_sources_types/1]). -export([fields/1, authz_sources_types/1]).

View File

@ -22,7 +22,7 @@
-include("emqx_authz.hrl"). -include("emqx_authz.hrl").
-include_lib("emqx/include/logger.hrl"). -include_lib("emqx/include/logger.hrl").
-import(hoconsc, [mk/1, mk/2, ref/1, ref/2, array/1, enum/1]). -import(hoconsc, [mk/1, mk/2, ref/2, array/1, enum/1]).
-define(BAD_REQUEST, 'BAD_REQUEST'). -define(BAD_REQUEST, 'BAD_REQUEST').
-define(NOT_FOUND, 'NOT_FOUND'). -define(NOT_FOUND, 'NOT_FOUND').

View File

@ -72,23 +72,23 @@ roots() ->
end, end,
emqx_schema_high_prio_roots() ++ emqx_schema_high_prio_roots() ++
[ {"node", [ {"node",
sc(hoconsc:ref("node"), sc(ref("node"),
#{ desc => "Node name, cookie, config & data directories " #{ desc => "Node name, cookie, config & data directories "
"and the Erlang virtual machine (BEAM) boot parameters." "and the Erlang virtual machine (BEAM) boot parameters."
})} })}
, {"cluster", , {"cluster",
sc(hoconsc:ref("cluster"), sc(ref("cluster"),
#{ desc => "EMQX nodes can form a cluster to scale up the total capacity.<br>" #{ desc => "EMQX nodes can form a cluster to scale up the total capacity.<br>"
"Here holds the configs to instruct how individual nodes " "Here holds the configs to instruct how individual nodes "
"can discover each other." "can discover each other."
})} })}
, {"log", , {"log",
sc(hoconsc:ref("log"), sc(ref("log"),
#{ desc => "Configure logging backends (to console or to file), " #{ desc => "Configure logging backends (to console or to file), "
"and logging level for each logger backend." "and logging level for each logger backend."
})} })}
, {"rpc", , {"rpc",
sc(hoconsc:ref("rpc"), sc(ref("rpc"),
#{ desc => "EMQX uses a library called <code>gen_rpc</code> for " #{ desc => "EMQX uses a library called <code>gen_rpc</code> for "
"inter-broker communication.<br/>Most of the time the default config " "inter-broker communication.<br/>Most of the time the default config "
"should work, but in case you need to do performance " "should work, but in case you need to do performance "
@ -941,7 +941,7 @@ roots(Module) ->
emqx_schema_high_prio_roots() -> emqx_schema_high_prio_roots() ->
Roots = emqx_schema:roots(high), Roots = emqx_schema:roots(high),
Authz = {"authorization", Authz = {"authorization",
sc(hoconsc:ref("authorization"), sc(hoconsc:ref(?MODULE, "authorization"),
#{ desc => """ #{ desc => """
Authorization a.k.a. ACL.<br> Authorization a.k.a. ACL.<br>
In EMQX, MQTT client access control is extremely flexible.<br> In EMQX, MQTT client access control is extremely flexible.<br>

View File

@ -173,7 +173,7 @@ t_update_re_failed(_Config) ->
{array, {ref,emqx_modules_schema,"rewrite"}}}]}, {array, {ref,emqx_modules_schema,"rewrite"}}}]},
roots => [root]}, roots => [root]},
[{validation_error, [{validation_error,
#{path => "rewrite.1.re", #{path => "root.rewrite.1.re",
reason => {<<"*^test/*">>,{"nothing to repeat",0}}, reason => {<<"*^test/*">>,{"nothing to repeat",0}},
value => <<"*^test/*">>}}]}}}, value => <<"*^test/*">>}}]}}},
?assertError(Error, emqx_rewrite:update(Rules)), ?assertError(Error, emqx_rewrite:update(Rules)),

View File

@ -68,7 +68,7 @@ root_fields() ->
, {install_dir, fun install_dir/1} , {install_dir, fun install_dir/1}
]. ].
states(type) -> hoconsc:array(hoconsc:ref(state)); states(type) -> hoconsc:array(hoconsc:ref(?MODULE, state));
states(required) -> false; states(required) -> false;
states(default) -> []; states(default) -> [];
states(desc) -> "An array of plugins in the desired states.<br>" states(desc) -> "An array of plugins in the desired states.<br>"