Browse Source

Merge branch 'master' of github.com:synrc/mad

Namdak Tonpa 9 years ago
parent
commit
1de59e1606
1 changed files with 16 additions and 1 deletions
  1. 16 1
      src/provision/mad_repl.erl

+ 16 - 1
src/provision/mad_repl.erl

@@ -35,7 +35,21 @@ load_config() ->
       File -> case file:consult(hd(File)) of
       File -> case file:consult(hd(File)) of
               {error,_} -> [];
               {error,_} -> [];
               {ok,[A]} -> A end end,
               {ok,[A]} -> A end end,
- [ begin [ application:set_env(App,K,V) || {K,V} <- Cfg ], {App,Cfg} end || {App,Cfg} <- Apps ].
+    load_config(Apps, []).
+
+load_config([H|T], Apps2) ->
+    App2 = case H of
+        {App,Cfg} -> [application:set_env(App,K,V) || {K,V} <- Cfg], [H];
+        File when is_list(File) ->
+            Apps = case file:consult(File) of
+                {error,_} -> [];
+                {ok,[A]} -> A end,
+            load_config(Apps, []);
+        _ -> []
+    end,
+    load_config(T, Apps2 ++ App2);
+load_config([], Apps2) ->
+    Apps2.
 
 
 acc_start(A,Acc) ->
 acc_start(A,Acc) ->
    case application:start(A) of
    case application:start(A) of
@@ -136,3 +150,4 @@ pp(Padding,V) -> k_io_lib_pretty:print(V, Padding, 80, 30, 60, fun(_,_)-> no end
 appconfig(Driver) ->
 appconfig(Driver) ->
     print("Configuration: ", load_config(), Driver),
     print("Configuration: ", load_config(), Driver),
     print("Applications: ",  applist(),     Driver).
     print("Applications: ",  applist(),     Driver).
+