فهرست منبع

fix: fill_default/3 should populate default values for all parameters except the 'ds'

zhongwencool 1 سال پیش
والد
کامیت
937fb153c2
1فایلهای تغییر یافته به همراه4 افزوده شده و 5 حذف شده
  1. 4 5
      apps/emqx/src/emqx_config.erl

+ 4 - 5
apps/emqx/src/emqx_config.erl

@@ -499,15 +499,14 @@ fill_defaults(RawConf, Opts) ->
     ).
 
 -spec fill_defaults(module(), raw_config(), hocon_tconf:opts()) -> map().
-fill_defaults(_SchemaMod, RawConf = #{<<"durable_storage">> := _}, _) ->
+fill_defaults(SchemaMod, RawConf = #{<<"durable_storage">> := Ds}, Opts) ->
     %% FIXME: kludge to prevent `emqx_config' module from filling in
     %% the default values for backends and layouts. These records are
     %% inside unions, and adding default values there will add
     %% incompatible fields.
-    %%
-    %% Note: this function is called for each individual conf root, so
-    %% this clause only affects this particular subtree.
-    RawConf;
+    RawConf1 = maps:remove(<<"durable_storage">>, RawConf),
+    Conf = fill_defaults(SchemaMod, RawConf1, Opts),
+    Conf#{<<"durable_storage">> => Ds};
 fill_defaults(SchemaMod, RawConf, Opts0) ->
     Opts = maps:merge(#{required => false, make_serializable => true}, Opts0),
     hocon_tconf:check_plain(