Fix 'ranch' app dependency upon re-start w/FLUs configured

... and allow direct start by machi_sup for EUnit tests.
This commit is contained in:
Scott Lystig Fritchie 2016-02-19 14:49:24 +09:00
parent c2e9a83372
commit ed56a2c6cf
2 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{application, machi, [
{description, "A village of write-once files."},
{vsn, "0.0.0"},
{applications, [kernel, stdlib, crypto, cluster_info]},
{vsn, "0.0.1"},
{applications, [kernel, stdlib, crypto, cluster_info, ranch]},
{mod,{machi_app,[]}},
{registered, []},
{env, [

View file

@ -65,5 +65,11 @@ init([]) ->
LifecycleMgr =
{machi_lifecycle_mgr, {machi_lifecycle_mgr, start_link, []},
Restart, Shutdown, worker, []},
{ok, {SupFlags, [ServerSup, RanchSup, LifecycleMgr]}}.
RunningApps = [A || {A,_D,_V} <- application:which_applications()],
Specs = case lists:member(ranch, RunningApps) of
true ->
[ServerSup, LifecycleMgr];
false ->
[ServerSup, RanchSup, LifecycleMgr]
end,
{ok, {SupFlags, Specs}}.