chore: Dynamically get the app that starts by default

This commit is contained in:
Turtle 2021-07-30 12:10:32 +08:00 committed by turtleDeng
parent e2d507cad9
commit ef1b591532
2 changed files with 11 additions and 16 deletions

View File

@ -221,13 +221,8 @@ shutdown(Reason) ->
reboot() ->
lists:foreach(fun application:start/1 , default_started_applications()).
-ifdef(EMQX_ENTERPRISE).
default_started_applications() ->
[gproc, esockd, ranch, cowboy, ekka, quicer, emqx].
-else.
default_started_applications() ->
[gproc, esockd, ranch, cowboy, ekka, quicer, emqx] ++ emqx_feature().
-endif.
%%--------------------------------------------------------------------
%% Internal functions
@ -239,15 +234,9 @@ reload_config(ConfFile) ->
[application:set_env(App, Par, Val) || {Par, Val} <- Vals]
end, Conf).
-ifndef(EMQX_DEP_APPS).
emqx_feature() -> [].
-else.
emqx_feature() ->
[ emqx_resource
, emqx_authn
, emqx_authz
, emqx_gateway
, emqx_data_bridge
, emqx_rule_engine
, emqx_bridge_mqtt
, emqx_modules
, emqx_management
, emqx_retainer].
?EMQX_DEP_APPS.
-endif.

View File

@ -133,10 +133,16 @@ test_deps() ->
].
common_compile_opts() ->
AppNames = list_dir("apps") ++
case is_enterprise() of
true -> list_dir("lib-ee");
false -> []
end,
[ debug_info % alwyas include debug_info
, {compile_info, [{emqx_vsn, get_vsn()}]}
, {d, snk_kind, msg}
] ++
[{d, 'EMQX_DEP_APPS', AppNames -- [emqx]}] ++
[{d, 'EMQX_ENTERPRISE'} || is_enterprise()] ++
[{d, 'EMQX_EXT_SCHEMAS', emqx_ext_schemas()}] ++
[{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1" ].