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 19:03:41 UTC

[couchdb] branch 3.x updated: fix: single node state (#2574) (#2578)

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

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


The following commit(s) were added to refs/heads/3.x by this push:
     new b3353a2  fix: single node state (#2574) (#2578)
b3353a2 is described below

commit b3353a27767b81ae2a1b29b5a3cf07f38270ef57
Author: Joan Touzet <wo...@users.noreply.github.com>
AuthorDate: Wed Feb 19 19:03:32 2020 +0000

    fix: single node state (#2574) (#2578)
    
    Co-authored-by: Jan Lehnardt <ja...@apache.org>
---
 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() ->