fix: get_roots broken
This commit is contained in:
parent
a862eb0252
commit
4dfcb90b16
|
@ -301,7 +301,7 @@ merge_envs(SchemaMod, RawConf) ->
|
||||||
},
|
},
|
||||||
hocon_tconf:merge_env_overrides(SchemaMod, RawConf, all, Opts).
|
hocon_tconf:merge_env_overrides(SchemaMod, RawConf, all, Opts).
|
||||||
|
|
||||||
-spec check_config(hocon_schema:shema(), raw_config()) -> {AppEnvs, CheckedConf}
|
-spec check_config(hocon_schema:schema(), raw_config()) -> {AppEnvs, CheckedConf}
|
||||||
when AppEnvs :: app_envs(), CheckedConf :: config().
|
when AppEnvs :: app_envs(), CheckedConf :: config().
|
||||||
check_config(SchemaMod, RawConf) ->
|
check_config(SchemaMod, RawConf) ->
|
||||||
check_config(SchemaMod, RawConf, #{}).
|
check_config(SchemaMod, RawConf, #{}).
|
||||||
|
|
|
@ -333,10 +333,6 @@ bin_path(ConfKeyPath) -> [bin(Key) || Key <- ConfKeyPath].
|
||||||
bin(A) when is_atom(A) -> atom_to_binary(A, utf8);
|
bin(A) when is_atom(A) -> atom_to_binary(A, utf8);
|
||||||
bin(B) when is_binary(B) -> B.
|
bin(B) when is_binary(B) -> B.
|
||||||
|
|
||||||
list(Atom) when is_atom(Atom) -> atom_to_list(Atom);
|
|
||||||
list(Bin) when is_binary(Bin) -> binary_to_list(Bin);
|
|
||||||
list(List) when is_list(List) -> List.
|
|
||||||
|
|
||||||
atom(Bin) when is_binary(Bin) ->
|
atom(Bin) when is_binary(Bin) ->
|
||||||
binary_to_atom(Bin, utf8);
|
binary_to_atom(Bin, utf8);
|
||||||
atom(Str) when is_list(Str) ->
|
atom(Str) when is_list(Str) ->
|
||||||
|
@ -368,12 +364,8 @@ assert_callback_function(Mod) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
schema(SchemaModule, [RootKey | _]) ->
|
schema(SchemaModule, [RootKey | _]) ->
|
||||||
Roots = SchemaModule:roots(),
|
Roots = hocon_schema:roots(SchemaModule),
|
||||||
Fields =
|
{_, Fields} = lists:keyfind(bin(RootKey), 1, Roots),
|
||||||
case lists:keyfind(list(RootKey), 1, Roots) of
|
|
||||||
false -> lists:keyfind(RootKey, 1, Roots);
|
|
||||||
Fields1 -> Fields1
|
|
||||||
end,
|
|
||||||
#{roots => [root], fields => #{root => [Fields]}}.
|
#{roots => [root], fields => #{root => [Fields]}}.
|
||||||
|
|
||||||
load_prev_handlers() ->
|
load_prev_handlers() ->
|
||||||
|
|
Loading…
Reference in New Issue