mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Start elixir config code only if elixir was enabled in configure script
This commit is contained in:
parent
ad39da0b0a
commit
4bd45bada7
@ -74,6 +74,7 @@
|
|||||||
{if_var_true, debug, debug_info},
|
{if_var_true, debug, debug_info},
|
||||||
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
|
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
|
||||||
{if_var_match, db_type, mssql, {d, 'mssql'}},
|
{if_var_match, db_type, mssql, {d, 'mssql'}},
|
||||||
|
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
|
||||||
{if_var_true, erlang_deprecated_types, {d, 'ERL_DEPRECATED_TYPES'}},
|
{if_var_true, erlang_deprecated_types, {d, 'ERL_DEPRECATED_TYPES'}},
|
||||||
{if_var_true, hipe, native},
|
{if_var_true, hipe, native},
|
||||||
{src_dirs, [asn1, src,
|
{src_dirs, [asn1, src,
|
||||||
|
@ -255,7 +255,12 @@ register_elixir_config_hooks() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
start_elixir_application() ->
|
start_elixir_application() ->
|
||||||
case application:ensure_started(elixir) of
|
case ejabberd_config:is_elixir_enabled() of
|
||||||
ok -> ok;
|
true ->
|
||||||
{error, _Msg} -> ?ERROR_MSG("Elixir application not started.", [])
|
case application:ensure_started(elixir) of
|
||||||
end.
|
ok -> ok;
|
||||||
|
{error, _Msg} -> ?ERROR_MSG("Elixir application not started.", [])
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
prepare_opt_val/4, convert_table_to_binary/5,
|
prepare_opt_val/4, convert_table_to_binary/5,
|
||||||
transform_options/1, collect_options/1, default_db/2,
|
transform_options/1, collect_options/1, default_db/2,
|
||||||
convert_to_yaml/1, convert_to_yaml/2, v_db/2,
|
convert_to_yaml/1, convert_to_yaml/2, v_db/2,
|
||||||
env_binary_to_list/2, opt_type/1, may_hide_data/1]).
|
env_binary_to_list/2, opt_type/1, may_hide_data/1,
|
||||||
|
is_elixir_enabled/0]).
|
||||||
|
|
||||||
-export([start/2]).
|
-export([start/2]).
|
||||||
|
|
||||||
@ -148,13 +149,18 @@ read_file(File) ->
|
|||||||
{include_modules_configs, true}]).
|
{include_modules_configs, true}]).
|
||||||
|
|
||||||
read_file(File, Opts) ->
|
read_file(File, Opts) ->
|
||||||
Terms1 = case 'Elixir.Ejabberd.ConfigUtil':is_elixir_config(File) of
|
Terms1 = case is_elixir_enabled() of
|
||||||
true ->
|
true ->
|
||||||
'Elixir.Ejabberd.Config':init(File),
|
case 'Elixir.Ejabberd.ConfigUtil':is_elixir_config(File) of
|
||||||
'Elixir.Ejabberd.Config':get_ejabberd_opts();
|
true ->
|
||||||
false ->
|
'Elixir.Ejabberd.Config':init(File),
|
||||||
get_plain_terms_file(File, Opts)
|
'Elixir.Ejabberd.Config':get_ejabberd_opts();
|
||||||
end,
|
false ->
|
||||||
|
get_plain_terms_file(File, Opts)
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
get_plain_terms_file(File, Opts)
|
||||||
|
end,
|
||||||
Terms_macros = case proplists:get_bool(replace_macros, Opts) of
|
Terms_macros = case proplists:get_bool(replace_macros, Opts) of
|
||||||
true -> replace_macros(Terms1);
|
true -> replace_macros(Terms1);
|
||||||
false -> Terms1
|
false -> Terms1
|
||||||
@ -1049,9 +1055,22 @@ replace_modules(Modules) ->
|
|||||||
%% Elixir module naming
|
%% Elixir module naming
|
||||||
%% ====================
|
%% ====================
|
||||||
|
|
||||||
|
-ifdef(ELIXIR_ENABLED).
|
||||||
|
is_elixir_enabled() ->
|
||||||
|
true.
|
||||||
|
-else.
|
||||||
|
is_elixir_enabled() ->
|
||||||
|
false.
|
||||||
|
-endif.
|
||||||
|
|
||||||
is_using_elixir_config() ->
|
is_using_elixir_config() ->
|
||||||
Config = get_ejabberd_config_path(),
|
case is_elixir_enabled() of
|
||||||
'Elixir.Ejabberd.ConfigUtil':is_elixir_config(Config).
|
true ->
|
||||||
|
Config = get_ejabberd_config_path(),
|
||||||
|
'Elixir.Ejabberd.ConfigUtil':is_elixir_config(Config);
|
||||||
|
false ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
%% If module name start with uppercase letter, this is an Elixir module:
|
%% If module name start with uppercase letter, this is an Elixir module:
|
||||||
is_elixir_module(Module) ->
|
is_elixir_module(Module) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user