You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2011/04/21 14:25:51 UTC
svn commit: r1095678 -
/couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl
Author: rnewson
Date: Thu Apr 21 12:25:51 2011
New Revision: 1095678
URL: http://svn.apache.org/viewvc?rev=1095678&view=rev
Log:
print https address if enabled. add to URI file also.
Modified:
couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl
Modified: couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl?rev=1095678&r1=1095677&r2=1095678&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_server_sup.erl Thu Apr 21 12:25:51 2011
@@ -119,15 +119,23 @@ start_server(IniFiles) ->
unlink(ConfigPid),
Ip = couch_config:get("httpd", "bind_address"),
- 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]),
-
+ Uris = [get_uri(Name, Ip) || Name <- [couch_httpd, https]],
+ [begin
+ case Uri of
+ undefined -> ok;
+ Uri -> ?LOG_INFO("Apache CouchDB has started on ~s", [Uri])
+ end
+ end
+ || Uri <- Uris],
case couch_config:get("couchdb", "uri_file", null) of
null -> ok;
UriFile ->
- Line = io_lib:format("http://~s:~w/~n", [Ip, Port]),
- file:write_file(UriFile, Line)
+ Lines = [begin case Uri of
+ undefined -> [];
+ Uri -> io_lib:format("~s~n", [Uri])
+ end end || Uri <- Uris],
+ file:write_file(UriFile, Lines)
end,
{ok, Pid}.
@@ -191,3 +199,22 @@ stop() ->
init(ChildSpecs) ->
{ok, ChildSpecs}.
+
+get_uri(Name, Ip) ->
+ case get_port(Name) of
+ undefined ->
+ undefined;
+ Port ->
+ io_lib:format("~s://~s:~w/", [get_scheme(Name), Ip, Port])
+ end.
+
+get_scheme(couch_httpd) -> "http";
+get_scheme(https) -> "https".
+
+get_port(Name) ->
+ try
+ mochiweb_socket_server:get(Name, port)
+ catch
+ exit:{noproc, _}->
+ undefined
+ end.