diff --git a/mix.exs b/mix.exs index 5006552ee..38fc3eb73 100644 --- a/mix.exs +++ b/mix.exs @@ -187,10 +187,14 @@ defmodule Ejabberd.MixProject do {:ok, path} -> path end - case :file.consult(filepath) do + config2 = case :file.consult(filepath) do {:ok,config} -> config _ -> [stun: true, zlib: true] end + case Mix.env() do + :dev -> List.keystore(config2, :tools, 0, {:tools, true}) + _ -> config2 + end end defp config(key) do diff --git a/src/ejabberd.app.src.script b/src/ejabberd.app.src.script index bf0c92512..089295804 100644 --- a/src/ejabberd.app.src.script +++ b/src/ejabberd.app.src.script @@ -6,10 +6,22 @@ {elixir, true} -> [elixir, iex, logger, mix]; _ -> [] end, - Tools = case lists:keyfind(tools, 1, Terms) of - {tools, true} -> [observer]; % for `ejabberdctl etop` + + ProfileEnvironmentVariable = os:getenv("REBAR_PROFILE"), + AsProfiles = case lists:dropwhile(fun("as") -> false; (_) -> true end, + init:get_plain_arguments()) of + ["as", Profiles | _] -> string:split(Profiles, ","); + _ -> [] + end, + Terms2 = case lists:member("dev", [ProfileEnvironmentVariable | AsProfiles]) of + true -> lists:keystore(tools, 1, Terms, {tools, true}); + false -> Terms + end, + Tools = case lists:keyfind(tools, 1, Terms2) of + {tools, true} -> [observer]; _ -> [] end, + {[lists:keyfind(description, 1, Terms), lists:keyfind(vsn, 1, Terms), {env, [{enabled_backends, EBs}]}