Преглед изворни кода

Merge pull request #5977 from zmstone/chore-pin-hocon-0.20.5

Pin hocon 0.20.5
Zaiming (Stone) Shi пре 4 година
родитељ
комит
bdeb1685e0

+ 1 - 1
apps/emqx/rebar.config

@@ -17,7 +17,7 @@
     , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.0"}}}
     , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.11.1"}}}
     , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
-    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.20.3"}}}
+    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.20.5"}}}
     , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
     , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.14.1"}}}

+ 3 - 6
apps/emqx/src/emqx_schema.erl

@@ -331,10 +331,7 @@ fields("mqtt") ->
     ];
 
 fields("zone") ->
-    Fields = ["mqtt", "stats", "flapping_detect", "force_shutdown",
-              "conn_congestion", "rate_limit", "quota", "force_gc",
-              "overload_protection"
-             ],
+    Fields = emqx_zone_schema:roots(),
     [{F, ref(emqx_zone_schema, F)} || F <- Fields];
 
 fields("rate_limit") ->
@@ -1358,9 +1355,9 @@ authentication(Desc) ->
     #{ type => hoconsc:lazy(hoconsc:union([typerefl:map(), hoconsc:array(typerefl:map())]))
      , desc => iolist_to_binary([Desc, "<br>", """
 Authentication can be one single authenticator instance or a chain of authenticators as an array.
-The when authenticating a login (username, client ID, etc.) the authenticators are checked
+When authenticating a login (username, client ID, etc.) the authenticators are checked
 in the configured order.<br>
 EMQ X comes with a set of pre-built autenticators, for more details, see
-<code>authenticator_config</code>.
+<a href=\"#root-authenticator_config\">autenticator_config<a>
 """])
      }.

+ 6 - 1
apps/emqx/src/emqx_zone_schema.erl

@@ -20,7 +20,12 @@
 
 namespace() -> zone.
 
-roots() -> [].
+%% this shcema module is not used at root level.
+%% roots are added only for document generation.
+roots() -> ["mqtt", "stats", "flapping_detect", "force_shutdown",
+            "conn_congestion", "rate_limit", "quota", "force_gc",
+            "overload_protection"
+           ].
 
 %% zone schemas are clones from the same name from root level
 %% only not allowed to have default values.

+ 6 - 3
apps/emqx/test/emqx_config_SUITE.erl

@@ -36,6 +36,7 @@ t_fill_default_values(_) ->
         <<"perf">> => #{},
         <<"route_batch_clean">> => false}
     },
+    WithDefaults = emqx_config:fill_defaults(Conf),
     ?assertMatch(#{<<"broker">> :=
       #{<<"enable_session_registry">> := true,
         <<"perf">> :=
@@ -45,6 +46,8 @@ t_fill_default_values(_) ->
         <<"session_locking_strategy">> := quorum,
         <<"shared_dispatch_ack_enabled">> := false,
         <<"shared_subscription_strategy">> := round_robin,
-        <<"sys_heartbeat_interval">> := "30s",
-        <<"sys_msg_interval">> := "1m"}},
-    emqx_config:fill_defaults(Conf)).
+        <<"sys_heartbeat_interval">> := <<"30s">>,
+        <<"sys_msg_interval">> := <<"1m">>}}, WithDefaults),
+    %% ensure JSON compatible
+    _ = emqx_json:encode(WithDefaults),
+    ok.

+ 1 - 1
rebar.config

@@ -63,7 +63,7 @@
     , {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x
     , {getopt, "1.0.2"}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.14.1"}}}
-    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.20.3"}}}
+    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.20.5"}}}
     , {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.4.1"}}}
     , {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
     , {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.1"}}}