You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2020/02/19 17:39:36 UTC

[couchdb] branch master updated: fix: single node state (#2575)

This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 91ecf67  fix: single node state (#2575)
91ecf67 is described below

commit 91ecf6777cc5fff93483b8e92c8daadd7ff33fdc
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Feb 19 18:39:24 2020 +0100

    fix: single node state (#2575)
---
 src/setup/src/setup.erl | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/setup/src/setup.erl b/src/setup/src/setup.erl
index 3d23229..cc64ae4 100644
--- a/src/setup/src/setup.erl
+++ b/src/setup/src/setup.erl
@@ -65,13 +65,15 @@ is_cluster_enabled() ->
     end.
 
 is_single_node_enabled(Dbs) ->
-    % admins != empty AND dbs exist
+    % admins != empty AND dbs exist OR `[couchdb] single_node` is set to true
     Admins = config:get("admins"),
     HasDbs = has_cluster_system_dbs(Dbs),
-    case {Admins, HasDbs} of
-        {[], _} -> false;
-        {_, false} -> false;
-        {_,_} -> true
+    SingleNodeConfig = config:get_boolean("couchdb", "single_node", false),
+    case {Admins, HasDbs, SingleNodeConfig} of
+        {_, _, true} -> true;
+        {[], _, _} -> false;
+        {_, false, _} -> false;
+        {_,_,_} -> true
     end.
 
 cluster_system_dbs() ->