Просмотр исходного кода

fix: the default values of Schema do not take effect

JianBo He 1 год назад
Родитель
Сommit
8059f2a92a
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      apps/emqx/src/emqx_config.erl

+ 5 - 0
apps/emqx/src/emqx_config.erl

@@ -397,8 +397,13 @@ fill_defaults_for_all_roots(SchemaMod, RawConf0) ->
 %% e.g. when testing an app, we need to load its config first
 %% then start emqx_conf application which will load the
 %% possibly empty config again (then filled with defaults).
+-ifdef(TEST).
 is_already_loaded(Name) ->
     ?MODULE:get_raw([Name], #{}) =/= #{}.
+-else.
+is_already_loaded(_) ->
+    false.
+-endif.
 
 %% if a root is not found in the raw conf, fill it with default values.
 seed_default(Schema) ->