diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-05-09 11:44:24 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-05-09 11:44:24 +0300 |
commit | 35a076c2517bf36ff5afb5bb38a674291a1ec607 (patch) | |
tree | 5dc611e5be47e5d049d6d7653f390bb495645b19 /src/ejabberd_app.erl | |
parent | Reduce IQ handler code copying (diff) |
Stop ejabberd initialization on invalid/unknown options
Since now, ejabberd doesn't ignore unknown options and doesn't
allow to have options with malformed values. The rationale for
this is to avoid unexpected behaviour during runtime, i.e. to
conform to "fail early" approach. Note that it's safe to reload
a configuration with potentialy invalid and/or unknown options:
this will not halt ejabberd, but will only prevent the configuration
from loading.
***NOTE FOR PACKAGE BUILDERS***
This new behaviour should be documented in the upgrade notes.
Diffstat (limited to 'src/ejabberd_app.erl')
-rw-r--r-- | src/ejabberd_app.erl | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index f1066815f..c7486a5be 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -46,22 +46,27 @@ start(normal, _Args) -> start_elixir_application(), ejabberd:check_app(ejabberd), setup_if_elixir_conf_used(), - ejabberd_config:start(), - ejabberd_mnesia:start(), - file_queue_init(), - maybe_add_nameservers(), - ejabberd_system_monitor:start(), - case ejabberd_sup:start_link() of - {ok, SupPid} -> - register_elixir_config_hooks(), - ejabberd_cluster:wait_for_sync(infinity), - {T2, _} = statistics(wall_clock), - ?INFO_MSG("ejabberd ~s is started in the node ~p in ~.2fs", - [?VERSION, node(), (T2-T1)/1000]), - lists:foreach(fun erlang:garbage_collect/1, processes()), - {ok, SupPid}; - Err -> - ?CRITICAL_MSG("Failed to start ejabberd application: ~p", [Err]), + case ejabberd_config:start() of + ok -> + ejabberd_mnesia:start(), + file_queue_init(), + maybe_add_nameservers(), + ejabberd_system_monitor:start(), + case ejabberd_sup:start_link() of + {ok, SupPid} -> + register_elixir_config_hooks(), + ejabberd_cluster:wait_for_sync(infinity), + {T2, _} = statistics(wall_clock), + ?INFO_MSG("ejabberd ~s is started in the node ~p in ~.2fs", + [?VERSION, node(), (T2-T1)/1000]), + lists:foreach(fun erlang:garbage_collect/1, processes()), + {ok, SupPid}; + Err -> + ?CRITICAL_MSG("Failed to start ejabberd application: ~p", [Err]), + ejabberd:halt() + end; + {error, Reason} -> + ?CRITICAL_MSG("Failed to start ejabberd application: ~p", [Reason]), ejabberd:halt() end; start(_, _) -> |