diff --git a/mix.exs b/mix.exs index fb90b2427..d7ef1707b 100644 --- a/mix.exs +++ b/mix.exs @@ -25,10 +25,11 @@ defmodule Ejabberd.Mixfile do def application do [mod: {:ejabberd_app, []}, - applications: [:ssl, :os_mon, :lager, :mnesia, :inets, :p1_utils, :cache_tab, - :fast_tls, :stringprep, :fast_xml, :xmpp, - :stun, :fast_yaml, :esip, :jiffy, :p1_oauth2, - :eimp, :base64url, :jose, :pkix] + applications: [:kernel, :stdlib, :sasl, :ssl], + included_applications: [:lager, :mnesia, :inets, :p1_utils, :cache_tab, + :fast_tls, :stringprep, :fast_xml, :xmpp, + :stun, :fast_yaml, :esip, :jiffy, :p1_oauth2, + :eimp, :base64url, :jose, :pkix] ++ cond_apps()] end diff --git a/src/ejabberd.app.src.in b/src/ejabberd.app.src.in index ea3a7894d..c3dc37306 100644 --- a/src/ejabberd.app.src.in +++ b/src/ejabberd.app.src.in @@ -5,7 +5,8 @@ {vsn, "@PACKAGE_VERSION@"}, {modules, []}, {registered, []}, - {applications, [kernel, stdlib, crypto, sasl, ssl, p1_utils, fast_yaml, fast_tls, pkix, xmpp, cache_tab, eimp]}, + {applications, [kernel, stdlib, sasl, ssl]}, + {included_applications, [lager, mnesia, inets, p1_utils, fast_yaml, fast_tls, pkix, xmpp, cache_tab, eimp]}, {env, [{enabled_backends, [@enabled_backends@]}]}, {mod, {ejabberd_app, []}}]}. diff --git a/src/ejabberd.erl b/src/ejabberd.erl index 5c632b36a..a7de9ab11 100644 --- a/src/ejabberd.erl +++ b/src/ejabberd.erl @@ -43,14 +43,10 @@ -include("logger.hrl"). start() -> - %%ejabberd_cover:start(), - ejabberd_logger:start(), - ejabberd_mnesia:start(), application:ensure_all_started(ejabberd). stop() -> application:stop(ejabberd). - %%ejabberd_cover:stop(). halt() -> application:stop(lager), diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index 280535ca7..1641e0ad9 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -41,6 +41,7 @@ start(normal, _Args) -> {T1, _} = statistics(wall_clock), ejabberd_logger:start(), write_pid_file(), + start_included_apps(), start_elixir_application(), ejabberd:check_app(ejabberd), setup_if_elixir_conf_used(), @@ -72,6 +73,17 @@ start(normal, _Args) -> start(_, _) -> {error, badarg}. +start_included_apps() -> + {ok, Apps} = application:get_key(ejabberd, included_applications), + lists:foreach( + fun(mnesia) -> + ok; + (lager)-> + ok; + (App) -> + application:ensure_all_started(App) + end, Apps). + %% Prepare the application for termination. %% This function is called when an application is about to be stopped, %% before shutting down the processes of the application.