refactor(emqx_config): check if upgrade_raw_conf is exported
This commit is contained in:
parent
6625754325
commit
eed44f79a6
|
@ -325,7 +325,7 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) ->
|
|||
ok = save_schema_mod_and_names(SchemaMod),
|
||||
HasDeprecatedFile = has_deprecated_file(),
|
||||
RawConf0 = load_config_files(HasDeprecatedFile, Conf),
|
||||
RawConf1 = apply(SchemaMod, upgrade_raw_conf, [RawConf0]),
|
||||
RawConf1 = upgrade_raw_conf(SchemaMod, RawConf0),
|
||||
warning_deprecated_root_key(RawConf1),
|
||||
RawConf2 =
|
||||
case HasDeprecatedFile of
|
||||
|
@ -342,6 +342,14 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) ->
|
|||
maybe_init_default_zone(),
|
||||
ok.
|
||||
|
||||
upgrade_raw_conf(SchemaMod, RawConf) ->
|
||||
case erlang:function_exported(SchemaMod, upgrade_raw_conf, 1) of
|
||||
true ->
|
||||
SchemaMod:upgrade_raw_conf(RawConf);
|
||||
false ->
|
||||
RawConf
|
||||
end.
|
||||
|
||||
%% Merge environment variable overrides on top, then merge with overrides.
|
||||
overlay_v0(SchemaMod, RawConf) when is_map(RawConf) ->
|
||||
RawConfWithEnvs = merge_envs(SchemaMod, RawConf),
|
||||
|
|
|
@ -174,7 +174,6 @@
|
|||
-export([password_converter/2, bin_str_converter/2]).
|
||||
-export([authz_fields/0]).
|
||||
-export([sc/2, map/2]).
|
||||
-export([upgrade_raw_conf/1]).
|
||||
|
||||
-elvis([{elvis_style, god_modules, disable}]).
|
||||
|
||||
|
@ -183,10 +182,6 @@
|
|||
-define(DEFAULT_MULTIPLIER, 1.5).
|
||||
-define(DEFAULT_BACKOFF, 0.75).
|
||||
|
||||
%% dummy callback from eqmx_config:init_load
|
||||
upgrade_raw_conf(RawConf) ->
|
||||
RawConf.
|
||||
|
||||
namespace() -> broker.
|
||||
|
||||
tags() ->
|
||||
|
|
Loading…
Reference in New Issue