refactor: allow accessing override config paths

This commit is contained in:
Zaiming (Stone) Shi 2021-12-03 22:52:55 +01:00
parent a723e41390
commit a1f79850b4
1 changed files with 4 additions and 2 deletions

View File

@ -328,13 +328,15 @@ read_override_conf(#{} = Opts) ->
File = override_conf_file(Opts), File = override_conf_file(Opts),
load_hocon_file(File, map). load_hocon_file(File, map).
override_conf_file(Opts) -> override_conf_file(Opts) when is_map(Opts) ->
Key = Key =
case maps:get(override_to, Opts, local) of case maps:get(override_to, Opts, local) of
local -> local_override_conf_file; local -> local_override_conf_file;
cluster -> cluster_override_conf_file cluster -> cluster_override_conf_file
end, end,
application:get_env(emqx, Key, undefined). application:get_env(emqx, Key, undefined);
override_conf_file(Which) when is_atom(Which) ->
application:get_env(emqx, Which, undefined).
-spec save_schema_mod_and_names(module()) -> ok. -spec save_schema_mod_and_names(module()) -> ok.
save_schema_mod_and_names(SchemaMod) -> save_schema_mod_and_names(SchemaMod) ->