summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Chesneau <benoitc@apache.org>2010-07-02 18:59:29 +0000
committerBenoit Chesneau <benoitc@apache.org>2010-07-02 18:59:29 +0000
commitd5f3e25e0cafc5cb8d2420406c9af8de56c552b0 (patch)
tree6ea7a66f4294aed099184523f407da93da5f52fe
parent8192f60dfc1cba6ea6a445ee604b98df42baef0f (diff)
close #COUCHDB-393. save the uri http://IP:PORT/ in
%localstatelibdir%/couch.uri when couchdb start. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@960087 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--etc/couchdb/default.ini.tpl.in1
-rw-r--r--src/couchdb/couch_server_sup.erl9
2 files changed, 9 insertions, 1 deletions
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index af6b9bf4..6b70777e 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -11,6 +11,7 @@ max_attachment_chunk_size = 4294967296 ; 4GB
os_process_timeout = 5000 ; 5 seconds. for view and external servers.
max_dbs_open = 100
delayed_commits = true ; set this to false to ensure an fsync before 201 Created is returned
+uri_file = %localstatelibdir%/couch.uri
[httpd]
port = 5984
diff --git a/src/couchdb/couch_server_sup.erl b/src/couchdb/couch_server_sup.erl
index 14849829..2de48d44 100644
--- a/src/couchdb/couch_server_sup.erl
+++ b/src/couchdb/couch_server_sup.erl
@@ -66,7 +66,7 @@ start_server(IniFiles) ->
[io:format(" [~s] ~s=~p~n", [Module, Variable, Value])
|| {{Module, Variable}, Value} <- couch_config:all()];
_ -> ok
- end,
+ end,
LibDir =
case couch_config:get("couchdb", "util_driver_dir", null) of
@@ -122,6 +122,13 @@ start_server(IniFiles) ->
Port = mochiweb_socket_server:get(couch_httpd, port),
io:format("Apache CouchDB has started. Time to relax.~n"),
?LOG_INFO("Apache CouchDB has started on http://~s:~w/", [Ip, Port]),
+
+ case couch_config:get("couchdb", "uri_file", null) of
+ null -> ok;
+ UriFile ->
+ Line = io_lib:format("http://~s:~w/", [Ip, Port]),
+ file:write_file(UriFile, Line)
+ end,
{ok, Pid}.