fix: fill_default/3 should populate default values for all parameters except the 'ds'
This commit is contained in:
parent
7b6b9580c8
commit
937fb153c2
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue