Permalink
Browse files

Fix some typos, ensure application is initialized.

  • Loading branch information...
1 parent 403f03a commit 489e66819af1dbe7533639179894bfa71efaf18d @cmeiklejohn cmeiklejohn committed Dec 3, 2012
Showing with 25 additions and 18 deletions.
  1. +1 −5 rel/files/app.config
  2. +0 −1 rel/vars.config
  3. +24 −12 src/riak_cs_control_sup.erl
View
@@ -3,11 +3,7 @@
[
%% Riak CS Control
{riak_cs_control, [
- %% Set to false to disable the control panel.
- {enabled, {{enabled}} },
-
%% Instance of Riak CS you wish to talk to.
- %%
{cs_hostname, "{{cs_hostname}}" },
{cs_port, {{cs_port}} },
{cs_protocol, "{{cs_protocol}}" },
@@ -19,7 +15,7 @@
%% Credentials you want the application to run as.
{cs_access_key_id, "{{cs_access_key_id}}" },
- {cs_secret_access_key_id, "{{cs_secret_access_key}}" },
+ {cs_secret_access_key, "{{cs_secret_access_key}}" },
%% Specify the bucket name for administration options.
{cs_administration_bucket, "{{cs_administration_bucket}}" }
View
@@ -11,7 +11,6 @@
%%
%% etc/app.config
%%
-{enabled, true}.
{cs_hostname, "s3.amazonaws.com"}.
{cs_port, 8080}.
{cs_protocol, "http"}.
@@ -35,15 +35,27 @@ init([]) ->
worker,
[riak_cs_control_session]},
- case app_helper:get_env(riak_cs_control, enabled, false) of
- true ->
- Resources = [riak_cs_control_wm_asset,
- riak_cs_control_wm_user,
- riak_cs_control_wm_users],
- Routes = lists:append([Module:routes() || Module <- Resources]),
- [webmachine_route:add_route(R) || R <- Routes],
-
- {ok, { {one_for_one, 10, 10}, [RiakCsControlSession]}};
- _ ->
- {ok, { {one_for_one, 10, 10}, []}}
- end.
+ Ip = case os:getenv("WEBMACHINE_IP") of
+ false -> "0.0.0.0";
+ Any -> Any end,
+
+ Resources = [riak_cs_control_wm_asset,
+ riak_cs_control_wm_user,
+ riak_cs_control_wm_users],
+
+ Dispatch = lists:flatten([Module:routes() || Module <- Resources]),
+
+ WebConfig = [
+ {name, http},
+ {ip, Ip},
+ {port, 8000},
+ {log_dir, "priv/log"},
+ {dispatch, Dispatch}],
+
+ Web = {http,
+ {webmachine_mochiweb, start, [WebConfig]},
+ permanent, 5000, worker, [mochiweb_socket_server]},
+
+ Processes = [Web, RiakCsControlSession],
+
+ {ok, {{one_for_one, 10, 10}, Processes}}.

0 comments on commit 489e668

Please sign in to comment.