summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiahuili <54631519+jiahuili430@users.noreply.github.com>2021-06-07 09:23:40 -0500
committerjiahuili <54631519+jiahuili430@users.noreply.github.com>2021-06-21 08:53:00 -0500
commitdedd8942b5201fca1c0063dac891ecac56bc11db (patch)
treeca327743728b20fd2b89345ef865f96f7d96e46c
parent8ac1978d78af2fc288bed1a99c092c44632ac35a (diff)
downloadcouchdb-dedd8942b5201fca1c0063dac891ecac56bc11db.tar.gz
normalize some config options
-rw-r--r--rebar.config.script2
-rw-r--r--rel/overlay/etc/default.ini108
-rw-r--r--src/chttpd/src/chttpd.erl21
-rw-r--r--src/chttpd/src/chttpd_db.erl8
-rw-r--r--src/chttpd/src/chttpd_misc.erl2
-rw-r--r--src/chttpd/src/chttpd_prefer_header.erl8
-rw-r--r--src/chttpd/src/chttpd_sup.erl7
-rw-r--r--src/chttpd/test/eunit/chttpd_util_test.erl67
-rw-r--r--src/couch/src/couch_db.erl14
-rw-r--r--src/couch/src/couch_doc.erl2
-rw-r--r--src/couch/src/couch_httpd.erl9
-rw-r--r--src/couch/src/couch_httpd_misc_handlers.erl2
-rw-r--r--src/couch/src/couch_proc_manager.erl11
-rw-r--r--src/couch/src/couch_query_servers.erl2
-rw-r--r--src/couch/src/couch_server.erl32
-rw-r--r--src/couch/src/couch_uuids.erl2
-rw-r--r--src/couch/test/eunit/couch_doc_json_tests.erl2
-rw-r--r--src/couch_replicator/src/couch_replicator_docs.erl40
-rw-r--r--src/couch_replicator/src/couch_replicator_ids.erl2
-rw-r--r--src/couch_replicator/test/eunit/couch_replicator_create_target_with_options_tests.erl4
-rw-r--r--src/custodian/src/custodian_util.erl2
-rw-r--r--src/fabric/src/fabric_doc_attachments.erl4
-rw-r--r--src/fabric/src/fabric_doc_atts.erl4
-rw-r--r--src/ioq/src/ioq.erl14
-rw-r--r--src/mem3/src/mem3.erl2
-rw-r--r--src/mem3/src/mem3_util.erl2
-rw-r--r--src/mem3/test/eunit/mem3_util_test.erl2
-rw-r--r--src/setup/src/setup_httpd.erl4
-rw-r--r--test/elixir/test/config_test.exs2
29 files changed, 172 insertions, 209 deletions
diff --git a/rebar.config.script b/rebar.config.script
index 96ee5dd28..52e4e4167 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -145,7 +145,7 @@ SubDirs = [
DepDescs = [
%% Independent Apps
-{config, "config", {tag, "2.1.8"}},
+{config, "config", {tag, "2.1.9"}},
{b64url, "b64url", {tag, "1.0.2"}},
{ets_lru, "ets-lru", {tag, "1.1.0"}},
{khash, "khash", {tag, "1.1.0"}},
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 5ac8da600..ac4972f76 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -8,13 +8,13 @@ database_dir = {{data_dir}}
view_index_dir = {{view_index_dir}}
; util_driver_dir =
; plugin_dir =
-os_process_timeout = 5000 ; 5 seconds. for view servers.
+;os_process_timeout = 5000 ; 5 seconds. for view servers.
; Maximum number of .couch files to open at once.
; The actual limit may be slightly lower depending on how
; many schedulers you have as the allowance is divided evenly
; among them.
-max_dbs_open = 500
+;max_dbs_open = 500
; Method used to compress everything that is appended to database and view index files, except
; for attachments (see the attachments section). Available methods are:
@@ -23,17 +23,17 @@ max_dbs_open = 500
; snappy - use google snappy, a very fast compressor/decompressor
; deflate_N - use zlib's deflate, N is the compression level which ranges from 1 (fastest,
; lowest compression ratio) to 9 (slowest, highest compression ratio)
-file_compression = snappy
+;file_compression = snappy
; Higher values may give better read performance due to less read operations
; and/or more OS page cache hits, but they can also increase overall response
; time for writes when there are many attachment write requests in parallel.
-attachment_stream_buffer_size = 4096
+;attachment_stream_buffer_size = 4096
; Default security object for databases if not explicitly set
; everyone - same as couchdb 1.0, everyone can read/write
; admin_only - only admins can read/write
; admin_local - sharded dbs on :5984 are read/write for everyone,
; local dbs on :5986 are read/write for admins only
-default_security = admin_only
+;default_security = admin_only
; btree_chunk_size = 1279
; maintenance_mode = false
; stem_interactive_updates = true
@@ -41,7 +41,7 @@ default_security = admin_only
; The speed of processing the _changes feed with doc_ids filter can be
; influenced directly with this setting - increase for faster processing at the
; expense of more memory usage.
-changes_doc_ids_optimization_threshold = 100
+;changes_doc_ids_optimization_threshold = 100
; Maximum document ID length. Can be set to an integer or 'infinity'.
;max_document_id_length = infinity
;
@@ -50,7 +50,7 @@ changes_doc_ids_optimization_threshold = 100
; requests which update a single document as well as individual documents from
; a _bulk_docs request. The size limit is approximate due to the nature of JSON
; encoding.
-max_document_size = 8000000 ; bytes
+;max_document_size = 8000000 ; bytes
;
; Maximum attachment size.
; max_attachment_size = 1073741824 ; 1 gibibyte
@@ -60,7 +60,7 @@ max_document_size = 8000000 ; bytes
;
; The default storage engine to use when creating databases
; is set as a key into the [couchdb_engines] section.
-default_engine = couch
+;default_engine = couch
;
; Enable this to only "soft-delete" databases when DELETE /{db} requests are
; made. This will place a .recovery directory in your data directory and
@@ -78,7 +78,7 @@ default_engine = couch
;single_node = false
; Allow edits on the _security object in the user db. By default, it's disabled.
-users_db_security_editable = false
+;users_db_security_editable = false
[purge]
; Allowed maximum number of documents in one purge request
@@ -106,8 +106,8 @@ couch = couch_bt_engine
;couch_server = false
[cluster]
-q=2
-n=3
+;q=2
+;n=3
; placement = metro-dc-a:2,metro-dc-b:1
; Supply a comma-delimited list of node names that this node should
@@ -121,18 +121,18 @@ n=3
; These settings affect the main, clustered port (5984 by default).
port = {{cluster_port}}
bind_address = 127.0.0.1
-backlog = 512
-socket_options = [{sndbuf, 262144}, {nodelay, true}]
-server_options = [{recbuf, undefined}]
-require_valid_user = false
+;backlog = 512
+;socket_options = [{sndbuf, 262144}, {nodelay, true}]
+;server_options = [{recbuf, undefined}]
+;require_valid_user = false
; require_valid_user_except_for_up = false
; List of headers that will be kept when the header Prefer: return=minimal is included in a request.
; If Server header is left out, Mochiweb will add its own one in.
-prefer_minimal = Cache-Control, Content-Length, Content-Range, Content-Type, ETag, Server, Transfer-Encoding, Vary
+;prefer_minimal = Cache-Control, Content-Length, Content-Range, Content-Type, ETag, Server, Transfer-Encoding, Vary
;
; Limit maximum number of databases when tying to get detailed information using
; _dbs_info in a request
-max_db_number_for_dbs_info_req = 100
+;max_db_number_for_dbs_info_req = 100
; set to true to delay the start of a response until the end has been calculated
;buffer_response = false
@@ -194,28 +194,28 @@ max_db_number_for_dbs_info_req = 100
; exists for each document in _users. These databases are writable only
; by the corresponding user. Databases are in the following form:
; userdb-{hex encoded username}
-enable = false
+;enable = false
; If set to true and a user is deleted, the respective database gets
; deleted as well.
-delete_dbs = false
+;delete_dbs = false
; Set a default q value for peruser-created databases that is different from
; cluster / q
;q = 1
; prefix for user databases. If you change this after user dbs have been
; created, the existing databases won't get deleted if the associated user
; gets deleted because of the then prefix mismatch.
-database_prefix = userdb-
+;database_prefix = userdb-
[httpd]
port = {{backend_port}}
bind_address = 127.0.0.1
-authentication_handlers = {couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}
+;authentication_handlers = {couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}
; Options for the MochiWeb HTTP server.
;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
; For more socket options, consult Erlang's module 'inet' man page.
;socket_options = [{recbuf, undefined}, {sndbuf, 262144}, {nodelay, true}]
-socket_options = [{sndbuf, 262144}]
+;socket_options = [{sndbuf, 262144}]
; These settings were moved to [chttpd]
; secure_rewrites, allow_jsonp, enable_cors, enable_xframe_options,
@@ -230,7 +230,7 @@ socket_options = [{sndbuf, 262144}]
; ratio = 0.01
[ssl]
-port = 6984
+;port = 6984
[chttpd_auth]
;authentication_db = _users
@@ -313,11 +313,11 @@ authentication_db = _users
; CSP (Content Security Policy) Support for _utils
[csp]
-enable = true
+;enable = true
; header_value = default-src 'self'; img-src 'self'; font-src *; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline';
[cors]
-credentials = false
+;credentials = false
; List of origins separated by a comma, * means accept all
; Origins must include the scheme: http://example.com
; You can't set origins: * and credentials = true at the same time.
@@ -364,8 +364,8 @@ credentials = false
; please let us know on the mailing list so we can fine tune the heuristic.
[query_server_config]
; commit_freq = 5
-reduce_limit = true
-os_process_limit = 100
+;reduce_limit = true
+;os_process_limit = 100
; os_process_idle_limit = 300
; os_process_soft_limit = 100
; Timeout for how long a response from a busy view group server can take.
@@ -407,42 +407,42 @@ partitioned||* = true
; First 14 characters are the time in hex. Last 18 are random.
; utc_id - Time since Jan 1, 1970 UTC with microseconds, plus utc_id_suffix string
; First 14 characters are the time in hex. uuids/utc_id_suffix string value is appended to these.
-algorithm = sequential
+;algorithm = sequential
; The utc_id_suffix value will be appended to uuids generated by the utc_id algorithm.
; Replicating instances should have unique utc_id_suffix values to ensure uniqueness of utc_id ids.
-utc_id_suffix =
+;utc_id_suffix =
# Maximum number of UUIDs retrievable from /_uuids in a single request
-max_count = 1000
+;max_count = 1000
[attachments]
-compression_level = 8 ; from 1 (lowest, fastest) to 9 (highest, slowest), 0 to disable compression
-compressible_types = text/*, application/javascript, application/json, application/xml
+;compression_level = 8 ; from 1 (lowest, fastest) to 9 (highest, slowest), 0 to disable compression
+;compressible_types = text/*, application/javascript, application/json, application/xml
[replicator]
; Random jitter applied on replication job startup (milliseconds)
-startup_jitter = 5000
+;startup_jitter = 5000
; Number of actively running replications
-max_jobs = 500
+;max_jobs = 500
;Scheduling interval in milliseconds. During each reschedule cycle
-interval = 60000
+;interval = 60000
; Maximum number of replications to start and stop during rescheduling.
-max_churn = 20
+;max_churn = 20
; More worker processes can give higher network throughput but can also
; imply more disk and network IO.
-worker_processes = 4
+;worker_processes = 4
; With lower batch sizes checkpoints are done more frequently. Lower batch sizes
; also reduce the total amount of used RAM memory.
-worker_batch_size = 500
+;worker_batch_size = 500
; Maximum number of HTTP connections per replication.
-http_connections = 20
+;http_connections = 20
; HTTP connection timeout per replication.
; Even for very fast/reliable networks it might need to be increased if a remote
; database is too busy.
-connection_timeout = 30000
+;connection_timeout = 30000
; Request timeout
;request_timeout = infinity
; If a request fails, the replicator will retry it up to N times.
-retries_per_request = 5
+;retries_per_request = 5
; Use checkpoints
;use_checkpoints = true
; Checkpoint interval
@@ -453,7 +453,7 @@ retries_per_request = 5
; {recbuf, integer()}
; {priority, integer()}
; See the `inet` Erlang module's man page for the full list of options.
-socket_options = [{keepalive, true}, {nodelay, false}]
+;socket_options = [{keepalive, true}, {nodelay, false}]
; Path to a file containing the user's certificate.
;cert_file = /full/path/to/server_cert.pem
; Path to file containing user's private PEM encoded key.
@@ -461,11 +461,11 @@ socket_options = [{keepalive, true}, {nodelay, false}]
; String containing the user's password. Only used if the private keyfile is password protected.
;password = somepassword
; Set to true to validate peer certificates.
-verify_ssl_certificates = false
+;verify_ssl_certificates = false
; File containing a list of peer trusted certificates (in the PEM format).
;ssl_trusted_certificates_file = /etc/ssl/certs/ca-certificates.crt
; Maximum peer certificate depth (must be set even if certificate validation is off).
-ssl_certificate_max_depth = 3
+;ssl_certificate_max_depth = 3
; Maximum document ID length for replication.
;max_document_id_length = infinity
; How much time to wait before retrying after a missing doc exception. This
@@ -543,7 +543,7 @@ ssl_certificate_max_depth = 3
; emergency, emerg
; none
;
-level = info
+;level = info
;
; Set the maximum log message length in bytes that will be
; passed through the writer
@@ -566,7 +566,7 @@ level = info
; over the network, and a journald writer that's more suitable
; when using systemd journald.
;
-writer = stderr
+;writer = stderr
; Journald Writer notes:
;
; The journald writer doesn't have any options. It still writes
@@ -634,11 +634,11 @@ writer = stderr
[ioq]
; The maximum number of concurrent in-flight IO requests that
-concurrency = 10
+;concurrency = 10
; The fraction of the time that a background IO request will be selected
; over an interactive IO request when both queues are non-empty
-ratio = 0.01
+;ratio = 0.01
[ioq.bypass]
; System administrators can choose to submit specific classes of IO directly
@@ -648,23 +648,23 @@ ratio = 0.01
; classes are recognized with the following defaults:
; Messages on their way to an external process (e.g., couchjs) are bypassed
-os_process = true
+;os_process = true
; Disk IO fulfilling interactive read requests is bypassed
-read = true
+;read = true
; Disk IO required to update a database is bypassed
-write = true
+;write = true
; Disk IO required to update views and other secondary indexes is bypassed
-view_update = true
+;view_update = true
; Disk IO issued by the background replication processes that fix any
; inconsistencies between shard copies is queued
-shard_sync = false
+;shard_sync = false
; Disk IO issued by compaction jobs is queued
-compaction = false
+;compaction = false
[dreyfus]
; The name and location of the Clouseau Java service required to
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index b11338eef..8fd05597d 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -57,6 +57,9 @@
buffer_response=false
}).
+-define(DEFAULT_SERVER_OPTIONS, "[{recbuf, undefined}]").
+-define(DEFAULT_SOCKET_OPTIONS, "[{sndbuf, 262144}, {nodelay, true}]").
+
start_link() ->
start_link(http).
start_link(http) ->
@@ -141,7 +144,12 @@ start_link(Name, Options) ->
end.
get_server_options(Module) ->
- ServerOptsCfg = config:get(Module, "server_options", "[]"),
+ ServerOptsCfg =
+ case Module of
+ "chttpd" -> config:get(Module,
+ "server_options", ?DEFAULT_SERVER_OPTIONS);
+ _ -> config:get(Module, "server_options", "[]")
+ end,
{ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg),
ServerOpts.
@@ -159,13 +167,10 @@ handle_request(MochiReq0) ->
handle_request_int(MochiReq) ->
Begin = os:timestamp(),
- case config:get("chttpd", "socket_options") of
- undefined ->
- ok;
- SocketOptsCfg ->
- {ok, SocketOpts} = couch_util:parse_term(SocketOptsCfg),
- ok = mochiweb_socket:setopts(MochiReq:get(socket), SocketOpts)
- end,
+ SocketOptsCfg = config:get(
+ "chttpd", "socket_options", ?DEFAULT_SOCKET_OPTIONS),
+ {ok, SocketOpts} = couch_util:parse_term(SocketOptsCfg),
+ ok = mochiweb_socket:setopts(MochiReq:get(socket), SocketOpts),
% for the path, use the raw path with the query string and fragment
% removed, but URL quoting left intact
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 27a564be8..8e528b5f2 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -1713,8 +1713,8 @@ parse_doc_query(Req) ->
parse_shards_opt(Req) ->
[
- {n, parse_shards_opt("n", Req, config:get("cluster", "n", "3"))},
- {q, parse_shards_opt("q", Req, config:get("cluster", "q", "8"))},
+ {n, parse_shards_opt("n", Req, config:get_integer("cluster", "n", 3))},
+ {q, parse_shards_opt("q", Req, config:get_integer("cluster", "q", 2))},
{placement, parse_shards_opt(
"placement", Req, config:get("cluster", "placement"))}
].
@@ -2230,7 +2230,7 @@ t_should_default_on_missing_q() ->
?_test(begin
Req = mock_request("/all-test21"),
Opts = parse_shards_opt(Req),
- ?assertEqual("8", couch_util:get_value(q, Opts))
+ ?assertEqual(2, couch_util:get_value(q, Opts))
end).
t_should_throw_on_invalid_q() ->
@@ -2251,7 +2251,7 @@ t_should_default_on_missing_n() ->
?_test(begin
Req = mock_request("/all-test21"),
Opts = parse_shards_opt(Req),
- ?assertEqual("3", couch_util:get_value(n, Opts))
+ ?assertEqual(3, couch_util:get_value(n, Opts))
end).
t_should_throw_on_invalid_n() ->
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 84dba5893..ffe0344b3 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -93,7 +93,7 @@ handle_utils_dir_req(#httpd{method='GET'}=Req, DocumentRoot) ->
{_ActionKey, "/", RelativePath} ->
% GET /_utils/path or GET /_utils/
CachingHeaders = [{"Cache-Control", "private, must-revalidate"}],
- EnableCsp = config:get("csp", "enable", "false"),
+ EnableCsp = config:get("csp", "enable", "true"),
Headers = maybe_add_csp_headers(CachingHeaders, EnableCsp),
chttpd:serve_file(Req, RelativePath, DocumentRoot, Headers);
{_ActionKey, "", _RelativePath} ->
diff --git a/src/chttpd/src/chttpd_prefer_header.erl b/src/chttpd/src/chttpd_prefer_header.erl
index 1ad1443ea..de2660399 100644
--- a/src/chttpd/src/chttpd_prefer_header.erl
+++ b/src/chttpd/src/chttpd_prefer_header.erl
@@ -22,6 +22,11 @@
-include_lib("couch/include/couch_db.hrl").
+-define(DEFAULT_PREFER_MINIMAL,
+ "Cache-Control, Content-Length, Content-Range, "
+ "Content-Type, ETag, Server, Transfer-Encoding, Vary").
+
+
maybe_return_minimal(#httpd{mochi_req = MochiReq}, Headers) ->
case get_prefer_header(MochiReq) of
"return=minimal" ->
@@ -47,7 +52,8 @@ filter_headers(Headers, IncludeList) ->
get_header_list() ->
- SectionStr = config:get("chttpd", "prefer_minimal", ""),
+ SectionStr = config:get("chttpd",
+ "prefer_minimal", ?DEFAULT_PREFER_MINIMAL),
split_list(SectionStr).
diff --git a/src/chttpd/src/chttpd_sup.erl b/src/chttpd/src/chttpd_sup.erl
index 5bcd4bd62..78fc66979 100644
--- a/src/chttpd/src/chttpd_sup.erl
+++ b/src/chttpd/src/chttpd_sup.erl
@@ -24,6 +24,8 @@
%% Helper macro for declaring children of supervisor
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 100, Type, [I]}).
+-define(DEFAULT_BACKLOG, 512).
+-define(DEFAULT_SERVER_OPTIONS, "[{recbuf, undefined}]").
start_link(Args) ->
case supervisor:start_link({local, ?MODULE}, ?MODULE, Args) of
@@ -75,8 +77,9 @@ settings() ->
[
{bind_address, config:get("chttpd", "bind_address")},
{port, config:get("chttpd", "port")},
- {backlog, config:get("chttpd", "backlog")},
- {server_options, config:get("chttpd", "server_options")}
+ {backlog, config:get_integer("chttpd", "backlog", ?DEFAULT_BACKLOG)},
+ {server_options, config:get("chttpd",
+ "server_options", ?DEFAULT_SERVER_OPTIONS)}
].
maybe_replace(Key, Value, Settings) ->
diff --git a/src/chttpd/test/eunit/chttpd_util_test.erl b/src/chttpd/test/eunit/chttpd_util_test.erl
index 07c985368..41fe6cb23 100644
--- a/src/chttpd/test/eunit/chttpd_util_test.erl
+++ b/src/chttpd/test/eunit/chttpd_util_test.erl
@@ -69,25 +69,17 @@ chttpd_util_config_test_() ->
fun setup/0,
fun teardown/1,
[
- ?TDEF_FE(test_behavior),
+ ?TDEF_FE(test_chttpd_behavior),
?TDEF_FE(test_with_undefined_option),
- ?TDEF_FE(test_with_httpd_option),
- ?TDEF_FE(test_with_chttpd_option),
- ?TDEF_FE(test_with_chttpd_option_which_moved_from_httpd),
- ?TDEF_FE(test_get_chttpd_config_integer),
- ?TDEF_FE(test_get_chttpd_config_boolean),
?TDEF_FE(test_auth_behavior),
- ?TDEF_FE(test_auth_with_undefined_option),
- ?TDEF_FE(test_auth_with_moved_options),
- ?TDEF_FE(test_get_chttpd_auth_config_integer),
- ?TDEF_FE(test_get_chttpd_auth_config_boolean)
+ ?TDEF_FE(test_auth_with_undefined_option)
]
}
}
}.
-test_behavior(_) ->
+test_chttpd_behavior(_) ->
?assertEqual("get_in_chttpd", chttpd_util:get_chttpd_config("both_exist")),
?assertEqual(1, chttpd_util:get_chttpd_config_integer("chttpd_only", 0)),
?assert(chttpd_util:get_chttpd_config_boolean("httpd_only", false)).
@@ -104,40 +96,6 @@ test_with_undefined_option(_) ->
?assertNot(chttpd_util:get_chttpd_config("undefined_option", false)).
-test_with_httpd_option(_) ->
- ?assertEqual("{couch_httpd_auth, cookie_authentication_handler}, " ++
- "{couch_httpd_auth, default_authentication_handler}",
- chttpd_util:get_chttpd_config("authentication_handlers")).
-
-
-test_with_chttpd_option(_) ->
- ?assertEqual("512", chttpd_util:get_chttpd_config("backlog")),
- ?assertEqual("512", chttpd_util:get_chttpd_config("backlog", 123)),
- ?assertEqual(512, chttpd_util:get_chttpd_config_integer("backlog", 123)),
- ?assertEqual("false",
- chttpd_util:get_chttpd_config("require_valid_user")),
- ?assertEqual("false",
- chttpd_util:get_chttpd_config("require_valid_user", "true")),
- ?assertEqual(false,
- chttpd_util:get_chttpd_config_boolean("require_valid_user", true)).
-
-
-test_with_chttpd_option_which_moved_from_httpd(_) ->
- ?assertEqual(undefined, chttpd_util:get_chttpd_config("max_uri_length")),
- ?assertEqual(8000, chttpd_util:get_chttpd_config("max_uri_length", 8000)),
- ?assertEqual(undefined, chttpd_util:get_chttpd_config("WWW-Authenticate")),
- ?assert(chttpd_util:get_chttpd_config("enable_cors", true)).
-
-
-test_get_chttpd_config_integer(_) ->
- ?assertEqual(123,
- chttpd_util:get_chttpd_config_integer("max_http_request_size", 123)).
-
-
-test_get_chttpd_config_boolean(_) ->
- ?assert(chttpd_util:get_chttpd_config_boolean("allow_jsonp", true)).
-
-
test_auth_behavior(_) ->
?assertEqual("ca", chttpd_util:get_chttpd_auth_config("both_exist")),
?assertEqual(1, chttpd_util:get_chttpd_auth_config_integer("ca_only", 0)),
@@ -153,22 +111,3 @@ test_auth_with_undefined_option(_) ->
?assertEqual("", chttpd_util:get_chttpd_auth_config("undefine", "")),
?assert(chttpd_util:get_chttpd_auth_config("undefine", true)),
?assertNot(chttpd_util:get_chttpd_auth_config("undefine", false)).
-
-
-test_auth_with_moved_options(_) ->
- ?assertEqual("/_utils/session.html", chttpd_util:get_chttpd_auth_config(
- "authentication_redirect", "/_utils/session.html")),
- ?assert(chttpd_util:get_chttpd_auth_config("require_valid_user", true)),
- ?assertEqual(10, chttpd_util:get_chttpd_auth_config("iterations", 10)).
-
-
-test_get_chttpd_auth_config_integer(_) ->
- ?assertEqual(123, chttpd_util:get_chttpd_auth_config_integer(
- "timeout", 123)).
-
-
-test_get_chttpd_auth_config_boolean(_) ->
- ?assertNot(chttpd_util:get_chttpd_auth_config_boolean(
- "require_valid_user", false)),
- ?assert(chttpd_util:get_chttpd_auth_config_boolean(
- "allow_persistent_cookies", true)).
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 390a198df..8837101ec 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -142,6 +142,8 @@
"^[a-z][a-z0-9\\_\\$()\\+\\-\\/]*" % use the stock CouchDB regex
"(\\.[0-9]{10,})?$" % but allow an optional shard timestamp at the end
).
+-define(DEFAULT_COMPRESSIBLE_TYPES,
+ "text/*, application/javascript, application/json, application/xml").
start_link(Engine, DbName, Filepath, Options) ->
Arg = {Engine, DbName, Filepath, Options},
@@ -1391,7 +1393,8 @@ compressible_att_type(MimeType) when is_binary(MimeType) ->
compressible_att_type(?b2l(MimeType));
compressible_att_type(MimeType) ->
TypeExpList = re:split(
- config:get("attachments", "compressible_types", ""),
+ config:get("attachments", "compressible_types",
+ ?DEFAULT_COMPRESSIBLE_TYPES),
"\\s*,\\s*",
[{return, list}]
),
@@ -1416,13 +1419,12 @@ compressible_att_type(MimeType) ->
% pretend that no Content-MD5 exists.
with_stream(Db, Att, Fun) ->
[InMd5, Type, Enc] = couch_att:fetch([md5, type, encoding], Att),
- BufferSize = list_to_integer(
- config:get("couchdb", "attachment_stream_buffer_size", "4096")),
+ BufferSize = config:get_integer("couchdb",
+ "attachment_stream_buffer_size", 4096),
Options = case (Enc =:= identity) andalso compressible_att_type(Type) of
true ->
- CompLevel = list_to_integer(
- config:get("attachments", "compression_level", "0")
- ),
+ CompLevel = config:get_integer(
+ "attachments", "compression_level", 8),
[
{buffer_size, BufferSize},
{encoding, gzip},
diff --git a/src/couch/src/couch_doc.erl b/src/couch/src/couch_doc.erl
index 33ad14f0b..ec16d21db 100644
--- a/src/couch/src/couch_doc.erl
+++ b/src/couch/src/couch_doc.erl
@@ -131,7 +131,7 @@ from_json_obj_validate(EJson) ->
from_json_obj_validate(EJson, undefined).
from_json_obj_validate(EJson, DbName) ->
- MaxSize = config:get_integer("couchdb", "max_document_size", 4294967296),
+ MaxSize = config:get_integer("couchdb", "max_document_size", 8000000),
Doc = from_json_obj(EJson, DbName),
case couch_ejson_size:encoded_size(Doc#doc.body) =< MaxSize of
true ->
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 5417bdd67..00379bbb4 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -44,6 +44,10 @@
-define(HANDLER_NAME_IN_MODULE_POS, 6).
-define(MAX_DRAIN_BYTES, 1048576).
-define(MAX_DRAIN_TIME_MSEC, 1000).
+-define(DEFAULT_SOCKET_OPTIONS, "[{sndbuf, 262144}]").
+-define(DEFAULT_AUTHENTICATION_HANDLERS,
+ "{couch_httpd_auth, cookie_authentication_handler}, "
+ "{couch_httpd_auth, default_authentication_handler}").
start_link() ->
start_link(http).
@@ -110,7 +114,7 @@ start_link(Name, Options) ->
{ok, ServerOptions} = couch_util:parse_term(
config:get("httpd", "server_options", "[]")),
{ok, SocketOptions} = couch_util:parse_term(
- config:get("httpd", "socket_options", "[]")),
+ config:get("httpd", "socket_options", ?DEFAULT_SOCKET_OPTIONS)),
set_auth_handlers(),
Handlers = get_httpd_handlers(),
@@ -152,7 +156,8 @@ stop() ->
set_auth_handlers() ->
AuthenticationSrcs = make_fun_spec_strs(
- config:get("httpd", "authentication_handlers", "")),
+ config:get("httpd", "authentication_handlers",
+ ?DEFAULT_AUTHENTICATION_HANDLERS)),
AuthHandlers = lists:map(
fun(A) -> {auth_handler_name(A), make_arity_1_fun(A)} end, AuthenticationSrcs),
AuthenticationFuns = AuthHandlers ++ [
diff --git a/src/couch/src/couch_httpd_misc_handlers.erl b/src/couch/src/couch_httpd_misc_handlers.erl
index 9bbede746..ea9c1cb84 100644
--- a/src/couch/src/couch_httpd_misc_handlers.erl
+++ b/src/couch/src/couch_httpd_misc_handlers.erl
@@ -82,7 +82,7 @@ handle_task_status_req(Req) ->
handle_uuids_req(#httpd{method='GET'}=Req) ->
- Max = list_to_integer(config:get("uuids","max_count","1000")),
+ Max = config:get_integer("uuids","max_count", 1000),
Count = try list_to_integer(couch_httpd:qs_value(Req, "count", "1")) of
N when N > Max ->
throw({bad_request, <<"count parameter too large">>});
diff --git a/src/couch/src/couch_proc_manager.erl b/src/couch/src/couch_proc_manager.erl
index 1f6d0167b..e7a25a6d2 100644
--- a/src/couch/src/couch_proc_manager.erl
+++ b/src/couch/src/couch_proc_manager.erl
@@ -584,11 +584,11 @@ can_spawn(#state{hard_limit = HardLimit, counts = Counts}, Lang) ->
get_proc_config() ->
- Limit = config:get("query_server_config", "reduce_limit", "true"),
- Timeout = config:get("couchdb", "os_process_timeout", "5000"),
+ Limit = config:get_boolean("query_server_config", "reduce_limit", true),
+ Timeout = config:get_integer("couchdb", "os_process_timeout", 5000),
{[
- {<<"reduce_limit">>, list_to_atom(Limit)},
- {<<"timeout">>, list_to_integer(Timeout)}
+ {<<"reduce_limit">>, Limit},
+ {<<"timeout">>, Timeout}
]}.
@@ -598,5 +598,4 @@ get_hard_limit() ->
get_soft_limit() ->
- LimStr = config:get("query_server_config", "os_process_soft_limit", "100"),
- list_to_integer(LimStr).
+ config:get_integer("query_server_config", "os_process_soft_limit", 100).
diff --git a/src/couch/src/couch_query_servers.erl b/src/couch/src/couch_query_servers.erl
index ebf82ab31..10b8048dd 100644
--- a/src/couch/src/couch_query_servers.erl
+++ b/src/couch/src/couch_query_servers.erl
@@ -623,7 +623,7 @@ proc_set_timeout(Proc, Timeout) ->
apply(Mod, Func, [Proc#proc.pid, Timeout]).
get_os_process_timeout() ->
- list_to_integer(config:get("couchdb", "os_process_timeout", "5000")).
+ config:get_integer("couchdb", "os_process_timeout", 5000).
get_ddoc_process(#doc{} = DDoc, DDocKey) ->
% remove this case statement
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index feeebdf17..04e8c6cf9 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -38,6 +38,7 @@
-define(MAX_DBS_OPEN, 500).
-define(RELISTEN_DELAY, 5000).
+-define(DEFAULT_ENGINE, "couch").
-record(server,{
root_dir = [],
@@ -270,10 +271,9 @@ init([N]) ->
RootDir = config:get("couchdb", "database_dir", "."),
Engines = get_configured_engines(),
- MaxDbsOpen = list_to_integer(
- config:get("couchdb", "max_dbs_open", integer_to_list(?MAX_DBS_OPEN))),
- UpdateLruOnRead =
- config:get("couchdb", "update_lru_on_read", "false") =:= "true",
+ MaxDbsOpen = config:get_integer("couchdb", "max_dbs_open", ?MAX_DBS_OPEN),
+ UpdateLruOnRead = config:get_boolean(
+ "couchdb", "update_lru_on_read", false),
ok = config:listen_for_changes(?MODULE, N),
ok = couch_file:init_delete_dir(RootDir),
hash_admin_passwords(),
@@ -823,20 +823,16 @@ get_default_engine(Server, DbName) ->
engines = Engines
} = Server,
Default = {couch_bt_engine, make_filepath(RootDir, DbName, "couch")},
- case config:get("couchdb", "default_engine") of
- Extension when is_list(Extension) ->
- case lists:keyfind(Extension, 1, Engines) of
- {Extension, Module} ->
- {ok, {Module, make_filepath(RootDir, DbName, Extension)}};
- false ->
- Fmt = "Invalid storage engine extension ~s,"
- " configured engine extensions are: ~s",
- Exts = [E || {E, _} <- Engines],
- Args = [Extension, string:join(Exts, ", ")],
- couch_log:error(Fmt, Args),
- {ok, Default}
- end;
- _ ->
+ Extension = config:get("couchdb", "default_engine", ?DEFAULT_ENGINE),
+ case lists:keyfind(Extension, 1, Engines) of
+ {Extension, Module} ->
+ {ok, {Module, make_filepath(RootDir, DbName, Extension)}};
+ false ->
+ Fmt = "Invalid storage engine extension ~s,"
+ " configured engine extensions are: ~s",
+ Exts = [E || {E, _} <- Engines],
+ Args = [Extension, string:join(Exts, ", ")],
+ couch_log:error(Fmt, Args),
{ok, Default}
end.
diff --git a/src/couch/src/couch_uuids.erl b/src/couch/src/couch_uuids.erl
index b9c03b502..3fffd04b3 100644
--- a/src/couch/src/couch_uuids.erl
+++ b/src/couch/src/couch_uuids.erl
@@ -98,7 +98,7 @@ inc() ->
couch_rand:uniform(16#ffd).
state() ->
- AlgoStr = config:get("uuids", "algorithm", "random"),
+ AlgoStr = config:get("uuids", "algorithm", "sequential"),
case couch_util:to_existing_atom(AlgoStr) of
random ->
random;
diff --git a/src/couch/test/eunit/couch_doc_json_tests.erl b/src/couch/test/eunit/couch_doc_json_tests.erl
index 51f228900..a68932eca 100644
--- a/src/couch/test/eunit/couch_doc_json_tests.erl
+++ b/src/couch/test/eunit/couch_doc_json_tests.erl
@@ -39,7 +39,7 @@ mock(couch_log) ->
mock(config) ->
meck:new(config, [passthrough]),
meck:expect(config, get_integer,
- fun("couchdb", "max_document_size", 4294967296) -> 1024 end),
+ fun("couchdb", "max_document_size", 8000000) -> 1024 end),
meck:expect(config, get, fun(_, _) -> undefined end),
meck:expect(config, get, fun(_, _, Default) -> Default end),
ok.
diff --git a/src/couch_replicator/src/couch_replicator_docs.erl b/src/couch_replicator/src/couch_replicator_docs.erl
index 3087195bd..cc2d33ae3 100644
--- a/src/couch_replicator/src/couch_replicator_docs.erl
+++ b/src/couch_replicator/src/couch_replicator_docs.erl
@@ -456,26 +456,26 @@ maybe_add_trailing_slash(Url) ->
make_options(Props) ->
Options0 = lists:ukeysort(1, convert_options(Props)),
Options = check_options(Options0),
- DefWorkers = config:get("replicator", "worker_processes", "4"),
- DefBatchSize = config:get("replicator", "worker_batch_size", "500"),
- DefConns = config:get("replicator", "http_connections", "20"),
- DefTimeout = config:get("replicator", "connection_timeout", "30000"),
- DefRetries = config:get("replicator", "retries_per_request", "5"),
- UseCheckpoints = config:get("replicator", "use_checkpoints", "true"),
- DefCheckpointInterval = config:get("replicator", "checkpoint_interval",
- "30000"),
+ DefWorkers = config:get_integer("replicator", "worker_processes", 4),
+ DefBatchSize = config:get_integer("replicator", "worker_batch_size", 500),
+ DefConns = config:get_integer("replicator", "http_connections", 20),
+ DefTimeout = config:get_integer("replicator", "connection_timeout", 30000),
+ DefRetries = config:get_integer("replicator", "retries_per_request", 5),
+ UseCheckpoints = config:get_boolean("replicator", "use_checkpoints", true),
+ DefCheckpointInterval = config:get_integer("replicator",
+ "checkpoint_interval", 30000),
{ok, DefSocketOptions} = couch_util:parse_term(
config:get("replicator", "socket_options",
"[{keepalive, true}, {nodelay, false}]")),
lists:ukeymerge(1, Options, lists:keysort(1, [
- {connection_timeout, list_to_integer(DefTimeout)},
- {retries, list_to_integer(DefRetries)},
- {http_connections, list_to_integer(DefConns)},
+ {connection_timeout, DefTimeout},
+ {retries, DefRetries},
+ {http_connections, DefConns},
{socket_options, DefSocketOptions},
- {worker_batch_size, list_to_integer(DefBatchSize)},
- {worker_processes, list_to_integer(DefWorkers)},
- {use_checkpoints, list_to_existing_atom(UseCheckpoints)},
- {checkpoint_interval, list_to_integer(DefCheckpointInterval)}
+ {worker_batch_size, DefBatchSize},
+ {worker_processes, DefWorkers},
+ {use_checkpoints, UseCheckpoints},
+ {checkpoint_interval, DefCheckpointInterval}
])).
@@ -587,14 +587,14 @@ parse_proxy_params(ProxyUrl) ->
ssl_params(Url) ->
case ibrowse_lib:parse_url(Url) of
#url{protocol = https} ->
- Depth = list_to_integer(
- config:get("replicator", "ssl_certificate_max_depth", "3")
- ),
- VerifyCerts = config:get("replicator", "verify_ssl_certificates"),
+ Depth = config:get_integer("replicator",
+ "ssl_certificate_max_depth", 3),
+ VerifyCerts = config:get_boolean("replicator",
+ "verify_ssl_certificates", false),
CertFile = config:get("replicator", "cert_file", undefined),
KeyFile = config:get("replicator", "key_file", undefined),
Password = config:get("replicator", "password", undefined),
- SslOpts = [{depth, Depth} | ssl_verify_options(VerifyCerts =:= "true")],
+ SslOpts = [{depth, Depth} | ssl_verify_options(VerifyCerts)],
SslOpts1 = case CertFile /= undefined andalso KeyFile /= undefined of
true ->
case Password of
diff --git a/src/couch_replicator/src/couch_replicator_ids.erl b/src/couch_replicator/src/couch_replicator_ids.erl
index 80ff0016a..316e6a28a 100644
--- a/src/couch_replicator/src/couch_replicator_ids.erl
+++ b/src/couch_replicator/src/couch_replicator_ids.erl
@@ -62,7 +62,7 @@ replication_id(#rep{} = Rep, 2) ->
% TODO: we might be under an SSL socket server only, or both under
% SSL and a non-SSL socket.
% ... mochiweb_socket_server:get(https, port)
- list_to_integer(config:get("httpd", "port", "5984"))
+ config:get_integer("httpd", "port", 5984)
end,
Src = get_rep_endpoint(Rep#rep.source),
Tgt = get_rep_endpoint(Rep#rep.target),
diff --git a/src/couch_replicator/test/eunit/couch_replicator_create_target_with_options_tests.erl b/src/couch_replicator/test/eunit/couch_replicator_create_target_with_options_tests.erl
index 63310d39e..dae4cd122 100644
--- a/src/couch_replicator/test/eunit/couch_replicator_create_target_with_options_tests.erl
+++ b/src/couch_replicator/test/eunit/couch_replicator_create_target_with_options_tests.erl
@@ -101,10 +101,10 @@ should_create_target_with_default({_Ctx, {Source, Target}}) ->
{ok, TargetInfo} = fabric:get_db_info(Target),
{ClusterInfo} = couch_util:get_value(cluster, TargetInfo),
- Q = config:get("cluster", "q", "8"),
+ Q = config:get_integer("cluster", "q", 2),
delete_db(Source),
delete_db(Target),
- ?_assertEqual(list_to_integer(Q), couch_util:get_value(q, ClusterInfo)).
+ ?_assertEqual(Q, couch_util:get_value(q, ClusterInfo)).
should_not_create_target_with_q_any({_Ctx, {Source, Target}}) ->
diff --git a/src/custodian/src/custodian_util.erl b/src/custodian/src/custodian_util.erl
index df095bd7c..ee217108f 100644
--- a/src/custodian/src/custodian_util.erl
+++ b/src/custodian/src/custodian_util.erl
@@ -149,7 +149,7 @@ get_n_rings(N, Ranges, Rings) ->
cluster_n() ->
- list_to_integer(config:get("cluster", "n", "3")).
+ config:get_integer("cluster", "n", 3).
maintenance_nodes(Nodes) ->
{Modes, _} = rpc:multicall(Nodes, config, get, ["couchdb", "maintenance_mode"]),
diff --git a/src/fabric/src/fabric_doc_attachments.erl b/src/fabric/src/fabric_doc_attachments.erl
index 723b9e804..922a89ea1 100644
--- a/src/fabric/src/fabric_doc_attachments.erl
+++ b/src/fabric/src/fabric_doc_attachments.erl
@@ -106,13 +106,13 @@ middleman(Req, chunked) ->
Receiver = spawn(fun() -> couch_httpd:recv_chunked(Req,4096,RcvFun,ok) end),
% take requests from the DB writers and get data from the receiver
- N = erlang:list_to_integer(config:get("cluster","n")),
+ N = config:get_integer("cluster", "n", 3),
Timeout = fabric_util:attachments_timeout(),
middleman_loop(Receiver, N, [], [], Timeout);
middleman(Req, Length) ->
Receiver = spawn(fun() -> receive_unchunked_attachment(Req, Length) end),
- N = erlang:list_to_integer(config:get("cluster","n")),
+ N = config:get_integer("cluster", "n", 3),
Timeout = fabric_util:attachments_timeout(),
middleman_loop(Receiver, N, [], [], Timeout).
diff --git a/src/fabric/src/fabric_doc_atts.erl b/src/fabric/src/fabric_doc_atts.erl
index a3aae80ec..65ba65f07 100644
--- a/src/fabric/src/fabric_doc_atts.erl
+++ b/src/fabric/src/fabric_doc_atts.erl
@@ -116,13 +116,13 @@ middleman(Req, chunked) ->
Receiver = spawn(fun() -> couch_httpd:recv_chunked(Req,4096,RcvFun,ok) end),
% take requests from the DB writers and get data from the receiver
- N = erlang:list_to_integer(config:get("cluster","n")),
+ N = config:get_integer("cluster", "n", 3),
Timeout = fabric_util:attachments_timeout(),
middleman_loop(Receiver, N, [], [], Timeout);
middleman(Req, Length) ->
Receiver = spawn(fun() -> receive_unchunked_attachment(Req, Length) end),
- N = erlang:list_to_integer(config:get("cluster","n")),
+ N = config:get_integer("cluster", "n", 3),
Timeout = fabric_util:attachments_timeout(),
middleman_loop(Receiver, N, [], [], Timeout).
diff --git a/src/ioq/src/ioq.erl b/src/ioq/src/ioq.erl
index 3da640e47..c3f9365bf 100644
--- a/src/ioq/src/ioq.erl
+++ b/src/ioq/src/ioq.erl
@@ -55,7 +55,15 @@ get_queue_lengths() ->
gen_server:call(?MODULE, get_queue_lengths).
bypass(Priority) ->
- config:get("ioq.bypass", atom_to_list(Priority)) =:= "true".
+ case Priority of
+ os_process -> config:get_boolean("ioq.bypass", "os_process", true);
+ read -> config:get_boolean("ioq.bypass", "read", true);
+ write -> config:get_boolean("ioq.bypass", "write", true);
+ view_update -> config:get_boolean("ioq.bypass", "view_update", true);
+ shard_sync -> config:get_boolean("ioq.bypass", "shard_sync", false);
+ compaction -> config:get_boolean("ioq.bypass", "compaction", false);
+ _ -> config:get("ioq.bypass", atom_to_list(Priority)) =:= "true"
+ end.
io_class({prompt, _}, _) ->
os_process;
@@ -91,8 +99,8 @@ init(_) ->
{ok, read_config(State)}.
read_config(State) ->
- Ratio = list_to_float(config:get("ioq", "ratio", "0.01")),
- Concurrency = list_to_integer(config:get("ioq", "concurrency", "10")),
+ Ratio = config:get_float("ioq", "ratio", 0.01),
+ Concurrency = config:get_integer("ioq", "concurrency", 10),
State#state{concurrency=Concurrency, ratio=Ratio}.
handle_call(get_queue_lengths, _From, State) ->
diff --git a/src/mem3/src/mem3.erl b/src/mem3/src/mem3.erl
index 6f3a10df8..86eb3bb45 100644
--- a/src/mem3/src/mem3.erl
+++ b/src/mem3/src/mem3.erl
@@ -204,7 +204,7 @@ choose_shards(DbName, Nodes, Options) ->
true -> ok
end,
Q = mem3_util:q_val(couch_util:get_value(q, Options,
- config:get("cluster", "q", "8"))),
+ config:get_integer("cluster", "q", 2))),
%% rotate to a random entry in the nodelist for even distribution
RotatedNodes = rotate_rand(Nodes),
mem3_util:create_partition_map(DbName, N, Q, RotatedNodes, Suffix).
diff --git a/src/mem3/src/mem3_util.erl b/src/mem3/src/mem3_util.erl
index 28cb17778..b63b2d448 100644
--- a/src/mem3/src/mem3_util.erl
+++ b/src/mem3/src/mem3_util.erl
@@ -240,7 +240,7 @@ db_props_from_json([{K, V} | Rest]) ->
[{K, V} | db_props_from_json(Rest)].
n_val(undefined, NodeCount) ->
- n_val(config:get("cluster", "n", "3"), NodeCount);
+ n_val(config:get_integer("cluster", "n", 3), NodeCount);
n_val(N, NodeCount) when is_list(N) ->
n_val(list_to_integer(N), NodeCount);
n_val(N, NodeCount) when is_integer(NodeCount), N > NodeCount ->
diff --git a/src/mem3/test/eunit/mem3_util_test.erl b/src/mem3/test/eunit/mem3_util_test.erl
index 8b74c4b2b..a8103bfd0 100644
--- a/src/mem3/test/eunit/mem3_util_test.erl
+++ b/src/mem3/test/eunit/mem3_util_test.erl
@@ -118,7 +118,7 @@ nval_test_() ->
fun() ->
meck:new([config, couch_log]),
meck:expect(couch_log, error, 2, ok),
- meck:expect(config, get, 3, "5")
+ meck:expect(config, get_integer, 3, 5)
end,
fun(_) -> meck:unload() end,
[
diff --git a/src/setup/src/setup_httpd.erl b/src/setup/src/setup_httpd.erl
index 44ea5d1a7..6d17186fb 100644
--- a/src/setup/src/setup_httpd.erl
+++ b/src/setup/src/setup_httpd.erl
@@ -36,8 +36,8 @@ handle_setup_req(#httpd{method='GET'}=Req) ->
true ->
chttpd:send_json(Req, 200, {[{state, single_node_enabled}]});
_ ->
- case config:get("cluster", "n", undefined) of
- "1" ->
+ case config:get_integer("cluster", "n", 3) of
+ 1 ->
case setup:is_single_node_enabled(Dbs) of
false ->
chttpd:send_json(Req, 200, {[{state, single_node_disabled}]});
diff --git a/test/elixir/test/config_test.exs b/test/elixir/test/config_test.exs
index 7600cecf2..1ad70a8a7 100644
--- a/test/elixir/test/config_test.exs
+++ b/test/elixir/test/config_test.exs
@@ -76,7 +76,7 @@ defmodule ConfigTest do
test "Standard config options are present", context do
assert context[:config]["couchdb"]["database_dir"]
- assert context[:config]["log"]["level"]
+ assert context[:config]["chttpd"]["port"]
end
test "Settings can be altered with undefined whitelist allowing any change", context do