Bladeren bron

chore: upgrade hocon to 0.26.3 to fix dialyzer warning

Zhongwen Deng 3 jaren geleden
bovenliggende
commit
bf6339ebf4
5 gewijzigde bestanden met toevoegingen van 15 en 15 verwijderingen
  1. 1 1
      apps/emqx/rebar.config
  2. 11 11
      apps/emqx/src/emqx_config_handler.erl
  3. 1 1
      apps/emqx_prometheus/rebar.config
  4. 1 1
      mix.exs
  5. 1 1
      rebar.config

+ 1 - 1
apps/emqx/rebar.config

@@ -19,7 +19,7 @@
     , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.1"}}}
     , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.1"}}}
     , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.12.2"}}}
     , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.12.2"}}}
     , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}}
     , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}}
-    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.1"}}}
+    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.3"}}}
     , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
     , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
     , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
     , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.18.0"}}}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.18.0"}}}

+ 11 - 11
apps/emqx/src/emqx_config_handler.erl

@@ -402,17 +402,7 @@ schema(SchemaModule, [RootKey | _]) ->
     {Field, Translations} =
     {Field, Translations} =
         case lists:keyfind(bin(RootKey), 1, Roots) of
         case lists:keyfind(bin(RootKey), 1, Roots) of
             {_, {Ref, ?REF(Ref)}} -> {Ref, ?R_REF(SchemaModule, Ref)};
             {_, {Ref, ?REF(Ref)}} -> {Ref, ?R_REF(SchemaModule, Ref)};
-            {_, {Name, Field0}} ->
-                case maps:take(translate_to, Field0) of
-                    {TRs, Field1} ->
-                        {
-                            {Name, Field1},
-                            lists:foldl(fun(T, Acc) ->
-                                Acc#{T => hocon_schema:translation(SchemaModule, T)}
-                                      end, #{}, TRs)
-                        };
-                    error -> {{Name, Field0}, #{}}
-                end
+            {_, {Name, Field0}} -> parse_translations(Field0, Name, SchemaModule)
         end,
         end,
     #{
     #{
         roots => [Field],
         roots => [Field],
@@ -420,6 +410,16 @@ schema(SchemaModule, [RootKey | _]) ->
         validations => hocon_schema:validations(SchemaModule)
         validations => hocon_schema:validations(SchemaModule)
     }.
     }.
 
 
+parse_translations(#{translate_to := TRs } = Field, Name, SchemaModule) ->
+    {
+        {Name, maps:remove(translate_to, Field)},
+        lists:foldl(fun(T, Acc) ->
+            Acc#{T => hocon_schema:translation(SchemaModule, T)}
+                    end, #{}, TRs)
+    };
+parse_translations(Field, Name, _SchemaModule) ->
+    {{Name, Field}, #{}}.
+
 load_prev_handlers() ->
 load_prev_handlers() ->
     Handlers = application:get_env(emqx, ?MODULE, #{}),
     Handlers = application:get_env(emqx, ?MODULE, #{}),
     application:unset_env(emqx, ?MODULE),
     application:unset_env(emqx, ?MODULE),

+ 1 - 1
apps/emqx_prometheus/rebar.config

@@ -4,7 +4,7 @@
  [ {emqx, {path, "../emqx"}},
  [ {emqx, {path, "../emqx"}},
    %% FIXME: tag this as v3.1.3
    %% FIXME: tag this as v3.1.3
    {prometheus, {git, "https://github.com/deadtrickster/prometheus.erl", {tag, "v4.8.1"}}},
    {prometheus, {git, "https://github.com/deadtrickster/prometheus.erl", {tag, "v4.8.1"}}},
-   {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.1"}}}
+   {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.3"}}}
  ]}.
  ]}.
 
 
 {edoc_opts, [{preprocess, true}]}.
 {edoc_opts, [{preprocess, true}]}.

+ 1 - 1
mix.exs

@@ -68,7 +68,7 @@ defmodule EMQXUmbrella.MixProject do
       # in conflict by emqtt and hocon
       # in conflict by emqtt and hocon
       {:getopt, "1.0.2", override: true},
       {:getopt, "1.0.2", override: true},
       {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.18.0", override: true},
       {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.18.0", override: true},
-      {:hocon, github: "emqx/hocon", tag: "0.26.1", override: true},
+      {:hocon, github: "emqx/hocon", tag: "0.26.3", override: true},
       {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.4.1", override: true},
       {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.4.1", override: true},
       {:esasl, github: "emqx/esasl", tag: "0.2.0"},
       {:esasl, github: "emqx/esasl", tag: "0.2.0"},
       {:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
       {:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},

+ 1 - 1
rebar.config

@@ -66,7 +66,7 @@
     , {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.2"}}}
     , {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.2"}}}
     , {getopt, "1.0.2"}
     , {getopt, "1.0.2"}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.18.0"}}}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.18.0"}}}
-    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.1"}}}
+    , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.26.3"}}}
     , {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.4.1"}}}
     , {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"}}}
     , {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
     , {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}
     , {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}