You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2008/04/01 01:56:17 UTC
svn commit: r643215 - in /incubator/couchdb/branches/mochiweb:
etc/couch.ini.tpl.in src/couchdb/couch_httpd.erl
src/couchdb/couch_server_sup.erl
Author: cmlenz
Date: Mon Mar 31 16:56:15 2008
New Revision: 643215
URL: http://svn.apache.org/viewvc?rev=643215&view=rev
Log:
mochiweb branch: configurable bind address and port.
Modified:
incubator/couchdb/branches/mochiweb/etc/couch.ini.tpl.in
incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl
Modified: incubator/couchdb/branches/mochiweb/etc/couch.ini.tpl.in
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/etc/couch.ini.tpl.in?rev=643215&r1=643214&r2=643215&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/etc/couch.ini.tpl.in (original)
+++ incubator/couchdb/branches/mochiweb/etc/couch.ini.tpl.in Mon Mar 31 16:56:15 2008
@@ -6,6 +6,10 @@
DbRootDir=%pkgstatelibdir%
+Port=5984
+
+BindAddress=127.0.0.1
+
DocumentRoot=%pkgdatadir%/www
LogFile=%pkgstatelogdir%/couch.log
Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl?rev=643215&r1=643214&r2=643215&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl Mon Mar 31 16:56:15 2008
@@ -13,11 +13,7 @@
-module(couch_httpd).
-include("couch_db.hrl").
--export([start_link/1, stop/0]).
--define(DEFAULTS, [
- {name, ?MODULE},
- {port, 5984}
-]).
+-export([start_link/3, stop/0]).
-record(doc_query_args, {
options = [],
@@ -38,9 +34,15 @@
skip = 0
}).
-start_link(DocumentRoot) ->
+start_link(BindAddress, Port, DocumentRoot) ->
+ couch_log:debug("Document root: ~p", [DocumentRoot]),
Loop = fun (Req) -> handle_request(Req, DocumentRoot) end,
- mochiweb_http:start([{loop, Loop} | ?DEFAULTS]).
+ mochiweb_http:start([
+ {loop, Loop},
+ {name, ?MODULE},
+ {ip, BindAddress},
+ {port, Port}
+ ]).
stop() ->
mochiweb_http:stop(?MODULE).
Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl?rev=643215&r1=643214&r2=643215&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl Mon Mar 31 16:56:15 2008
@@ -65,6 +65,8 @@
ConsoleStartupMsg = proplists:get_value({"Couch", "ConsoleStartupMsg"}, Ini, "Apache CouchDB is starting."),
LogLevel = list_to_atom(proplists:get_value({"Couch", "LogLevel"}, Ini, "error")),
DbRootDir = proplists:get_value({"Couch", "DbRootDir"}, Ini, "."),
+ BindAddress = proplists:get_value({"Couch", "BindAddress"}, Ini, any),
+ Port = proplists:get_value({"Couch", "Port"}, Ini, 5984),
DocumentRoot = proplists:get_value({"Couch", "DocumentRoot"}, Ini, "share/www"),
LogFile = proplists:get_value({"Couch", "LogFile"}, Ini, "couchdb.log"),
UtilDriverDir = proplists:get_value({"Couch", "UtilDriverDir"}, Ini, ""),
@@ -112,7 +114,7 @@
worker,
[couch_view]},
{couch_httpd,
- {couch_httpd, start_link, [DocumentRoot]},
+ {couch_httpd, start_link, [BindAddress, Port, DocumentRoot]},
permanent,
1000,
supervisor,
@@ -148,6 +150,8 @@
ConfigInfo = io_lib:format("Config Info ~s:~n\tCurrentWorkingDir=~s~n" ++
"\tDbRootDir=~s~n" ++
+ "\tBindAddress=~s~n" ++
+ "\tPort=~s~n" ++
"\tDocumentRoot=~s~n" ++
"\tLogFile=~s~n" ++
"\tUtilDriverDir=~s~n" ++
@@ -157,6 +161,8 @@
[IniFilename,
Cwd,
DbRootDir,
+ BindAddress,
+ Port,
DocumentRoot,
LogFile,
UtilDriverDir,