fix(config): option only_fill_defaults renamed to make_serializable
This commit is contained in:
parent
fa7433628c
commit
350023e757
|
@ -446,7 +446,7 @@ fill_defaults(RawConf, Opts) ->
|
||||||
|
|
||||||
-spec fill_defaults(module(), raw_config(), hocon_tconf:opts()) -> map().
|
-spec fill_defaults(module(), raw_config(), hocon_tconf:opts()) -> map().
|
||||||
fill_defaults(SchemaMod, RawConf, Opts0) ->
|
fill_defaults(SchemaMod, RawConf, Opts0) ->
|
||||||
Opts = maps:merge(#{required => false, only_fill_defaults => true}, Opts0),
|
Opts = maps:merge(#{required => false, make_serializable => true}, Opts0),
|
||||||
hocon_tconf:check_plain(
|
hocon_tconf:check_plain(
|
||||||
SchemaMod,
|
SchemaMod,
|
||||||
RawConf,
|
RawConf,
|
||||||
|
|
|
@ -1133,7 +1133,7 @@ find_config(AuthenticatorID, AuthenticatorsConfig) ->
|
||||||
fill_defaults(Configs) when is_list(Configs) ->
|
fill_defaults(Configs) when is_list(Configs) ->
|
||||||
lists:map(fun fill_defaults/1, Configs);
|
lists:map(fun fill_defaults/1, Configs);
|
||||||
fill_defaults(Config) ->
|
fill_defaults(Config) ->
|
||||||
emqx_authn:check_config(merge_default_headers(Config), #{only_fill_defaults => true}).
|
emqx_authn:check_config(merge_default_headers(Config), #{make_serialiable => true}).
|
||||||
|
|
||||||
merge_default_headers(Config) ->
|
merge_default_headers(Config) ->
|
||||||
case maps:find(<<"headers">>, Config) of
|
case maps:find(<<"headers">>, Config) of
|
||||||
|
|
|
@ -451,8 +451,7 @@ get_raw_sources() ->
|
||||||
RawSources = emqx:get_raw_config([authorization, sources], []),
|
RawSources = emqx:get_raw_config([authorization, sources], []),
|
||||||
Schema = #{roots => emqx_authz_schema:fields("authorization"), fields => #{}},
|
Schema = #{roots => emqx_authz_schema:fields("authorization"), fields => #{}},
|
||||||
Conf = #{<<"sources">> => RawSources},
|
Conf = #{<<"sources">> => RawSources},
|
||||||
Options = #{only_fill_defaults => true},
|
#{<<"sources">> := Sources} = hocon_tconf:make_serializable(Schema, Conf, #{}),
|
||||||
#{<<"sources">> := Sources} = hocon_tconf:check_plain(Schema, Conf, Options),
|
|
||||||
merge_default_headers(Sources).
|
merge_default_headers(Sources).
|
||||||
|
|
||||||
merge_default_headers(Sources) ->
|
merge_default_headers(Sources) ->
|
||||||
|
|
|
@ -484,8 +484,7 @@ get_raw_config() ->
|
||||||
RawConfig = emqx:get_raw_config([exhook, servers], []),
|
RawConfig = emqx:get_raw_config([exhook, servers], []),
|
||||||
Schema = #{roots => emqx_exhook_schema:fields(exhook), fields => #{}},
|
Schema = #{roots => emqx_exhook_schema:fields(exhook), fields => #{}},
|
||||||
Conf = #{<<"servers">> => RawConfig},
|
Conf = #{<<"servers">> => RawConfig},
|
||||||
Options = #{only_fill_defaults => true},
|
#{<<"servers">> := Servers} = hocon_tconf:make_serializable(Schema, Conf, #{}),
|
||||||
#{<<"servers">> := Servers} = hocon_tconf:check_plain(Schema, Conf, Options),
|
|
||||||
Servers.
|
Servers.
|
||||||
|
|
||||||
position_example() ->
|
position_example() ->
|
||||||
|
|
Loading…
Reference in New Issue