diff --git a/mix.exs b/mix.exs index 16496771e..3714a8fed 100644 --- a/mix.exs +++ b/mix.exs @@ -165,7 +165,7 @@ defmodule Ejabberd.MixProject do {Mix.env() == :translations, {:ejabberd_po, git: "https://github.com/processone/ejabberd-po.git"}}, {Mix.env() == :dev, - {:exsync, "~> 0.2"}}, + {:exsync, "~> 0.2", optional: true, runtime: false}}, {config(:redis), {:eredis, "~> 1.2.0"}}, {config(:sip), {:esip, "~> 1.0"}}, {config(:zlib), {:ezlib, "~> 1.0"}}, @@ -183,7 +183,6 @@ defmodule Ejabberd.MixProject do defp cond_apps do for {:true, app} <- [{config(:stun), :stun}, - {Map.has_key?(System.get_env(), "RELIVE"), :exsync}, {if_version_below(~c"27", true), :jiffy}, {config(:tools), :observer}], do: app diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index 3fcfd65eb..a0065a8fa 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -59,6 +59,7 @@ start(normal, _Args) -> ejabberd_hooks:run(ejabberd_started, []), ejabberd:check_apps(), ejabberd_systemd:ready(), + maybe_start_exsync(), {T2, _} = statistics(wall_clock), ?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs", [ejabberd_option:version(), @@ -198,8 +199,15 @@ start_elixir_application() -> ok -> ok; {error, _Msg} -> ?ERROR_MSG("Elixir application not started.", []) end. + +maybe_start_exsync() -> + case os:getenv("RELIVE") of + "true" -> rpc:call(node(), 'Elixir.ExSync.Application', start, []); + _ -> ok + end. -else. setup_if_elixir_conf_used() -> ok. register_elixir_config_hooks() -> ok. start_elixir_application() -> ok. +maybe_start_exsync() -> ok. -endif.