Anonymous avatar Anonymous committed 5b94565

Add start_apps configuration parameter for starting additional applications.
Move check for loadability of storage_backend until after add_paths and start_apps are processed.

Comments (0)

Files changed (1)

     set_erlenv(ConfigPairs),
     check_erlenv(ConfigPath),
     [code:add_path(Path) || Path <- riak:get_app_env(add_paths)],
+    [application:start(App) || App <- riak:get_app_env(start_apps)],
+    StorageBackend = riak:get_app_env(storage_backend),
+    case code:ensure_loaded(StorageBackend) of
+        {error,nofile} ->
+            riak:stop(lists:flatten(io_lib:format(
+                        "storage_backend ~p in ~p non-loadable, failing.",
+                        [StorageBackend, ConfigPath])));
+        _ ->
+            ok
+    end,
     ok.
 
 %% @private
      WantsClaimFun,ChooseClaimFun,GossipInterval,
      DoorbellPort,StorageBackend,RiakCookie,RiakAddPaths,
      RiakNodeName,RiakHostName,RiakHeartCommand,
-     DefaultBucketProps] =
+     DefaultBucketProps,RiakStartApps] =
         [riak:get_app_env(X) || X <- 
            [cluster_name,ring_state_dir,ring_creation_size,
             wants_claim_fun,choose_claim_fun,gossip_interval,
             doorbell_port,storage_backend,riak_cookie,add_paths,
             riak_nodename,riak_hostname,riak_heart_command,
-            default_bucket_props]],
+            default_bucket_props,start_apps]],
     if
         ClusterName =:= undefined ->
             riak:stop(io_lib:format(
         not is_atom(StorageBackend) ->
             riak:stop(io_lib:format(
                     "storage_backend in ~p non-atom, failing.",[ConfigPath]));
-        true ->
-            case code:ensure_loaded(StorageBackend) of
-                {error,nofile} ->
-                    riak:stop(io_lib:format(
-                           "storage_backend ~p in ~p non-loadable, failing.",
-                           [StorageBackend, ConfigPath]));
-                _ ->
-                    ok
-            end
+        true -> ok
     end,
     if
         RiakCookie =:= undefined ->
                         "default_bucket_props in ~p non-list, failing.",
                         [ConfigPath]))
     end,
+    if 
+        RiakStartApps =:= undefined ->
+            error_logger:info_msg(
+              "start_apps unset in ~p, setting to []~n",
+              [ConfigPath]),
+            application:set_env(riak, start_apps, []);
+        not is_list(RiakStartApps) ->
+            riak:stop(io_lib:format(
+                        "start_apps in ~p non-list, failing.",[ConfigPath]));
+        true -> ok
+    end,
     ok.
 
 set_bucket_params(In) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.