diff --git a/apps/emqx/src/emqx_config.erl b/apps/emqx/src/emqx_config.erl index 791b2fd25..5b4a43d7e 100644 --- a/apps/emqx/src/emqx_config.erl +++ b/apps/emqx/src/emqx_config.erl @@ -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), diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 98d46c30b..d9fd12ab5 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -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() ->