couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r690513 - in /incubator/couchdb/trunk: etc/couchdb/ src/couchdb/
Date Sat, 30 Aug 2008 14:27:02 GMT
Author: jan
Date: Sat Aug 30 07:27:01 2008
New Revision: 690513

URL: http://svn.apache.org/viewvc?rev=690513&view=rev
Log:
- Rename configuration options and sections to allow for a nicer .ini file and HTTP API calls.
- Enable .ini parser to read variable assignments with spaces around the '='-sign.
- Remove inadequate comment.

Modified:
    incubator/couchdb/trunk/etc/couchdb/default.ini.tpl.in
    incubator/couchdb/trunk/src/couchdb/couch_config.erl
    incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl
    incubator/couchdb/trunk/src/couchdb/couch_ft_query.erl
    incubator/couchdb/trunk/src/couchdb/couch_httpd.erl
    incubator/couchdb/trunk/src/couchdb/couch_log.erl
    incubator/couchdb/trunk/src/couchdb/couch_query_servers.erl
    incubator/couchdb/trunk/src/couchdb/couch_server.erl
    incubator/couchdb/trunk/src/couchdb/couch_server_sup.erl
    incubator/couchdb/trunk/src/couchdb/couch_util.erl
    incubator/couchdb/trunk/src/couchdb/couch_view.erl

Modified: incubator/couchdb/trunk/etc/couchdb/default.ini.tpl.in
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/etc/couchdb/default.ini.tpl.in?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/etc/couchdb/default.ini.tpl.in (original)
+++ incubator/couchdb/trunk/etc/couchdb/default.ini.tpl.in Sat Aug 30 07:27:01 2008
@@ -2,22 +2,20 @@
 
 ; Upgrading CouchDB will overwrite this file.
 
-[CouchDB]
-RootDirectory=%localstatelibdir%
-UtilDriverDir=%couchprivlibdir%
-MaximumDocumentSize=4294967296 ; 4 GB
+[couchdb]
+database_dir = %localstatelibdir%
+util_driver_dir = %couchprivlibdir%
+max_document_size = 4294967296 ; 4 GB
+view_timeout = 5000 ; 5 seconds
+
+[httpd]
+port = 5984
+bind_address = 127.0.0.1
+utils_dir = %localdatadir%/www
+
+[log]
+file = %localstatelogdir%/couch.log
+level = info
 
-[HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=%localdatadir%/www
-
-[Log]
-File=%localstatelogdir%/couch.log
-Level=info
-
-[CouchDB Query Servers]
-javascript=%bindir%/%couchjs_command_name% %localdatadir%/server/main.js
-
-[CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+[query_servers]
+javascript = %bindir%/%couchjs_command_name% %localdatadir%/server/main.js

Modified: incubator/couchdb/trunk/src/couchdb/couch_config.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_config.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_config.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_config.erl Sat Aug 30 07:27:01 2008
@@ -161,7 +161,7 @@
             ";" ++ _Comment ->
                 {AccSectionName, AccValues};
             Line2 ->
-                case regexp:split(Line2, "=") of
+                case regexp:split(Line2, "\s?=\s?") of
                 {ok, [_SingleElement]} -> % no "=" found, ignore this line
                     {AccSectionName, AccValues};
                 {ok, [""|_LineValues]} -> % line begins with "=", ignore

Modified: incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl Sat Aug 30 07:27:01 2008
@@ -29,7 +29,7 @@
 %% @doc Saves a Module/Key/Value triple to the ini file File::filename()
 save_to_file({{Module, Variable}, Value}, File) ->
 
-    ?LOG_DEBUG("saving to file '~s', Congif: '~p'", [File, {{Module, Variable}, Value}]),
+    ?LOG_DEBUG("saving to file '~s', Config: '~p'", [File, {{Module, Variable}, Value}]),
 
     % open file and create a list of lines
     {ok, Stream} = file:read_file(File),
@@ -84,7 +84,7 @@
             case lists:member(Variable, DoneVariables) of
                 false ->
                     DoneVariables2 = [Variable|DoneVariables],
-                    Variable ++ "=" ++ Value ++ "\n" ++ Line;
+                    Variable ++ " = " ++ Value ++ "\n" ++ Line;
                 true ->
                     DoneVariables2 = DoneVariables,
                     Line

Modified: incubator/couchdb/trunk/src/couchdb/couch_ft_query.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_ft_query.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_ft_query.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_ft_query.erl Sat Aug 30 07:27:01 2008
@@ -28,11 +28,11 @@
 
 init([]) ->
     ok = couch_config:register(
-        fun({"Search", "QueryServer"}) ->
+        fun({"search", "query_server"}) ->
             ?MODULE:stop()
         end),
     
-    case couch_config:get({"Search", "QueryServer"}, none) of
+    case couch_config:get({"search", "query_server"}, none) of
     none ->
         {ok, none};
     QueryExec ->

Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_httpd.erl Sat Aug 30 07:27:01 2008
@@ -44,9 +44,9 @@
     % just stop if one of the config settings change. couch_server_sup
     % will restart us and then we will pick up the new settings.
 
-    BindAddress = couch_config:get({"HTTPd", "BindAddress"}, any),
-    Port = couch_config:get({"HTTPd", "Port"}, "5984"),
-    DocumentRoot = couch_config:get({"HTTPd", "DocumentRoot"}, "../../share/www"),
+    BindAddress = couch_config:get({"httpd", "bind_address"}, any),
+    Port = couch_config:get({"httpd", "port"}, "5984"),
+    DocumentRoot = couch_config:get({"httpd", "utils_dir"}, "../../share/www"),
 
     % and off we go
     Loop = fun (Req) -> apply(couch_httpd, handle_request, [Req, DocumentRoot]) end,
@@ -57,11 +57,11 @@
         {port, Port}
     ]),
     ok = couch_config:register(
-        fun({"HTTPd", "BindAddress"}) ->
+        fun({"httpd", "bind_address"}) ->
             ?MODULE:stop();
-        ({"HTTPd", "Port"}) ->
+        ({"httpd", "port"}) ->
             ?MODULE:stop();
-        ({"HTTPd", "DocumentRoot"}) ->
+        ({"httpd", "utils_dir"}) ->
             ?MODULE:stop()
         end, Pid),
 

Modified: incubator/couchdb/trunk/src/couchdb/couch_log.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_log.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_log.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_log.erl Sat Aug 30 07:27:01 2008
@@ -46,14 +46,14 @@
     % just stop if one of the config settings change. couch_server_sup
     % will restart us and then we will pick up the new settings.
     ok = couch_config:register(
-        fun({"Log", "File"}) ->
+        fun({"log", "file"}) ->
             ?MODULE:stop();
-        ({"Log", "Level"}) ->
+        ({"log", "level"}) ->
             ?MODULE:stop()
         end),
     
-    Filename = couch_config:get({"Log", "File"}, "couchdb.log"),
-    Level = couch_config:get({"Log", "Level"},"info"),
+    Filename = couch_config:get({"log", "file"}, "couchdb.log"),
+    Level = couch_config:get({"log", "level"},"info"),
 
     {ok, Fd} = file:open(Filename, [append]),
     {ok, {Fd, level_integer(list_to_atom(Level))}}.

Modified: incubator/couchdb/trunk/src/couchdb/couch_query_servers.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_query_servers.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_query_servers.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_query_servers.erl Sat Aug 30 07:27:01 2008
@@ -36,7 +36,7 @@
     case get(query_server_timeout) of
     undefined ->
         Timeout = list_to_integer(couch_config:get(
-            {"CouchDB Query Server Options", "QueryTimeout"}, "5000")),
+            {"couchdb", "view_timeout"}, "5000")),
         put(timeout, Timeout);
     Timeout -> ok
     end,
@@ -178,12 +178,12 @@
     % will restart us and then we will pick up the new settings.
     
     ok = couch_config:register(
-        fun({"CouchDB Query Server" ++ _, _}) ->
+        fun({"query_servers" ++ _, _}) ->
             ?MODULE:stop()
         end),
         
     QueryServerList = couch_config:lookup_match(
-            {{"CouchDB Query Servers", '$1'}, '$2'}, []),
+            {{"query_servers", '$1'}, '$2'}, []),
         
     {ok, {QueryServerList, []}}.
 

Modified: incubator/couchdb/trunk/src/couchdb/couch_server.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_server.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_server.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_server.erl Sat Aug 30 07:27:01 2008
@@ -30,7 +30,7 @@
     }).
 
 start() ->
-    start(["couch.ini"]).
+    start(["default.ini"]).
 
 start(IniFiles) ->
     couch_server_sup:start_link(IniFiles).
@@ -94,13 +94,13 @@
     % just stop if one of the config settings change. couch_server_sup
     % will restart us and then we will pick up the new settings.
 
-    RootDir = couch_config:get({"CouchDB", "RootDirectory"}, "."),
-    MaxDbsOpen = couch_config:get({"CouchDB", "MaxDbsOpen"}, "100"),
+    RootDir = couch_config:get({"couchdb", "database_dir"}, "."),
+    MaxDbsOpen = couch_config:get({"couchdb", "max_open_databases"}, "100"),
     Self = self(),
     ok = couch_config:register(
-        fun({"CouchDB", "RootDirectory"}) ->
+        fun({"couchdb", "database_dir"}) ->
             exit(Self, config_change);
-        ({"CouchDB", "ServerOptions"}) ->
+        ({"couchdb", "server_options"}) ->
             exit(Self, config_change)
         end),
     {ok, RegExp} = regexp:parse("^[a-z][a-z0-9\\_\\$()\\+\\-\\/]*$"),
@@ -261,7 +261,7 @@
         {reply, Error, Server}
     end;
 handle_call(remote_restart, _From, Server) ->
-    case couch_config:get({"CouchDB", "AllowRemoteRestart"}, "false") of
+    case couch_config:get({"couchdb", "allow_remote_restart"}, "false") of
     "true" ->
         exit(couch_server_sup, restart);
     _ ->

Modified: incubator/couchdb/trunk/src/couchdb/couch_server_sup.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_server_sup.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_server_sup.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_server_sup.erl Sat Aug 30 07:27:01 2008
@@ -49,7 +49,7 @@
     
     {ok, ConfigPid} = couch_config:start_link(IniFiles),
     
-    LogLevel = couch_config:get({"Log", "Level"}, "info"),
+    LogLevel = couch_config:get({"log", "level"}, "info"),
     % announce startup
     io:format("Apache CouchDB ~s (LogLevel=~s) is starting.~n", [
         couch_server:get_version(),
@@ -64,7 +64,7 @@
     end,
     
     LibDir =
-    case couch_config:get({"CouchDB", "UtilDriverDir"}, null) of
+    case couch_config:get({"couchdb", "util_driver_dir"}, null) of
     null ->
         filename:join(code:priv_dir(couch), "lib");
     LibDir0 -> LibDir0
@@ -100,7 +100,7 @@
     % just restart if one of the config settings change.
 
     couch_config:register(
-        fun({"CouchDB", "UtilDriverDir"}) ->
+        fun({"couchdb", "util_driver_dir"}) ->
             ?MODULE:stop()
         end, Pid),
     

Modified: incubator/couchdb/trunk/src/couchdb/couch_util.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_util.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_util.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_util.erl Sat Aug 30 07:27:01 2008
@@ -23,8 +23,6 @@
 -define(FLUSH_MAX_MEM, 10000000).
 
 start_driver(LibDir) ->
-    % read config and register for configuration changes
-    
     case erl_ddll:load_driver(LibDir, "couch_erl_driver") of
     ok ->
         ok;

Modified: incubator/couchdb/trunk/src/couchdb/couch_view.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_view.erl?rev=690513&r1=690512&r2=690513&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_view.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_view.erl Sat Aug 30 07:27:01 2008
@@ -222,10 +222,10 @@
 
 init([]) ->
     % read configuration settings and register for configuration changes
-    RootDir = couch_config:get({"CouchDB", "RootDirectory"}),
+    RootDir = couch_config:get({"couchdb", "database_dir"}),
     Self = self(),
     ok = couch_config:register(
-        fun({"CouchDB", "RootDirectory"})->
+        fun({"couchdb", "database_dir"})->
             exit(Self, config_change)
         end),
         



Mime
View raw message