Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

enable wriaki to work with webmachine over yaws or cowboy

  • Loading branch information...
commit 1de551751df965f1a65cb97ddf6b9aca93c4e7cb 1 parent cd43773
@vinoski vinoski authored
View
15 apps/wriaki/src/wriaki_sup.erl
@@ -1,6 +1,6 @@
%% -------------------------------------------------------------------
%%
-%% Copyright (c) 2009-2010 Basho Technologies, Inc. All Rights Reserved.
+%% Copyright (c) 2009-2013 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@@ -28,6 +28,10 @@
%% Supervisor callbacks
-export([init/1]).
+-ifndef(WRIAKI_BACKEND).
+-define(WRIAKI_BACKEND, webmachine_mochiweb).
+-endif.
+
%% Helper macro for declaring children of supervisor
-define(CHILD(Mod, Conf),
{Mod, {Mod, start, [Conf]}, permanent, 5000, worker, [Mod]}).
@@ -46,7 +50,7 @@ start_link() ->
init([]) ->
wriaki:set_bucket_props(),
wriaki:read_mapred_js(),
-
+
Ip = wriaki:get_app_env(web_ip, "0.0.0.0"),
Port = wriaki:get_app_env(web_port, 8000),
LogDir = wriaki:get_app_env(log_dir, "priv/log"),
@@ -61,8 +65,7 @@ init([]) ->
{log_dir, LogDir},
{dispatch, Dispatch}
],
- Web = {webmachine_mochiweb,
- {webmachine_mochiweb, start, [WebConfig]},
- permanent, 5000, worker, [webmachine_mochiweb]},
-
+ Web = {?WRIAKI_BACKEND,
+ {?WRIAKI_BACKEND, start, [WebConfig]},
+ permanent, 5000, worker, [?WRIAKI_BACKEND]},
{ok, {{one_for_one, 5, 10}, [Web]}}.
View
BIN  rebar
Binary file not shown
View
6 rebar.config
@@ -1,9 +1,7 @@
{sub_dirs, ["apps/wiki_creole", "apps/wriaki", "rel"]}.
{deps,
- [{webmachine, "1.9.0",
- {git, "git://github.com/basho/webmachine", "7dbc8e42041938997a4a"}},
- {mochiweb, "1.5.1",
- {git, "git://github.com/mochi/mochiweb", "bed36252198ae7159e3d"}},
+ [{webmachine, "1.9.*",
+ {git, "git://github.com/vinoski/webmachine", {branch, "yaws"}}},
{erlydtl, "0.6.1",
{git, "git://github.com/evanmiller/erlydtl", "14872e22e62c82b71e41"}},
{riakc, "1.2.0",
View
14 rebar.config.script
@@ -0,0 +1,14 @@
+%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ft=erlang ts=4 sw=4 et
+
+case os:getenv("WEBMACHINE_SERVER") of
+ false ->
+ %% default to mochiweb
+ Define = [{d, 'WRIAKI_BACKEND', webmachine_mochiweb}],
+ lists:keystore(erl_opts, 1, CONFIG, {erl_opts, Define});
+ Else ->
+ %% mochiweb, yaws, or cowboy
+ Backend = list_to_atom("webmachine_" ++ Else),
+ Define = [{d, 'WRIAKI_BACKEND', Backend}],
+ lists:keystore(erl_opts, 1, CONFIG, {erl_opts, Define})
+end.
View
1  rel/reltool.config
@@ -28,6 +28,7 @@
{app, wriaki, [{incl_cond, include}]},
{app, wiki_creole, [{incl_cond, include}]},
{app, webmachine, [{incl_cond, include}]},
+ {app, yaws, [{incl_cond, include}]},
{app, erlydtl, [{incl_cond, include}]},
{app, sasl, [{incl_cond, include}]}
]}.
Please sign in to comment.
Something went wrong with that request. Please try again.