Преглед изворни кода

fix(emqx_machine_boot): Fix excluded_apps

ieQu1 пре 2 година
родитељ
комит
7b44caeae4
1 измењених фајлова са 12 додато и 5 уклоњено
  1. 12 5
      apps/emqx_machine/src/emqx_machine_boot.erl

+ 12 - 5
apps/emqx_machine/src/emqx_machine_boot.erl

@@ -30,12 +30,19 @@
 -export([sorted_reboot_apps/1, reboot_apps/0]).
 -export([sorted_reboot_apps/1, reboot_apps/0]).
 -endif.
 -endif.
 
 
-%% these apps are always (re)started by emqx_machine
+%% These apps are always (re)started by emqx_machine:
 -define(BASIC_REBOOT_APPS, [gproc, esockd, ranch, cowboy, emqx]).
 -define(BASIC_REBOOT_APPS, [gproc, esockd, ranch, cowboy, emqx]).
 
 
-%% If any of these applications crash, the entire EMQX node shuts down
+%% If any of these applications crash, the entire EMQX node shuts down:
 -define(BASIC_PERMANENT_APPS, [mria, ekka, esockd, emqx]).
 -define(BASIC_PERMANENT_APPS, [mria, ekka, esockd, emqx]).
 
 
+%% These apps should NOT be (re)started automatically:
+-define(EXCLUDED_APPS, [system_monitor, observer_cli, jq]).
+
+%% These apps are optional, they may or may not be present in the
+%% release, depending on the build flags:
+-define(OPTIONAL_APPS, [bcrypt, observer]).
+
 post_boot() ->
 post_boot() ->
     ok = ensure_apps_started(),
     ok = ensure_apps_started(),
     ok = print_vsn(),
     ok = print_vsn(),
@@ -148,9 +155,9 @@ basic_reboot_apps() ->
     ?BASIC_REBOOT_APPS ++ (BusinessApps -- excluded_apps()).
     ?BASIC_REBOOT_APPS ++ (BusinessApps -- excluded_apps()).
 
 
 excluded_apps() ->
 excluded_apps() ->
-    OptionalApps = [bcrypt, jq, observer],
-    [system_monitor, observer_cli] ++
-        [App || App <- OptionalApps, not is_app(App)].
+    %% Optional apps _should_ be (re)started automatically, but only
+    %% when they are found in the release:
+    ?EXCLUDED_APPS ++ [App || App <- ?OPTIONAL_APPS, not is_app(App)].
 
 
 is_app(Name) ->
 is_app(Name) ->
     case application:load(Name) of
     case application:load(Name) of