summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2020-02-19 21:55:15 +0100
committerJoan Touzet <wohali@users.noreply.github.com>2020-02-20 04:00:26 +0000
commitdc6a06c836a5ecae8920b6c7eca1cfec55fcfb33 (patch)
treee0f1b715563383467c5e00723f946ded2e5d46f4
parentf892de13ace39c49770b2f0206777388721b4783 (diff)
downloadcouchdb-dc6a06c836a5ecae8920b6c7eca1cfec55fcfb33.tar.gz
fix: show single node on setup status with single_node=true
-rw-r--r--src/setup/src/setup_httpd.erl36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/setup/src/setup_httpd.erl b/src/setup/src/setup_httpd.erl
index f4e05ce09..949675b6a 100644
--- a/src/setup/src/setup_httpd.erl
+++ b/src/setup/src/setup_httpd.erl
@@ -31,24 +31,30 @@ handle_setup_req(#httpd{method='GET'}=Req) ->
ok = chttpd:verify_is_server_admin(Req),
Dbs = chttpd:qs_json_value(Req, "ensure_dbs_exist", setup:cluster_system_dbs()),
couch_log:notice("Dbs: ~p~n", [Dbs]),
- case erlang:list_to_integer(config:get("cluster", "n", undefined)) of
- 1 ->
- case setup:is_single_node_enabled(Dbs) of
- false ->
- chttpd:send_json(Req, 200, {[{state, single_node_disabled}]});
- true ->
- chttpd:send_json(Req, 200, {[{state, single_node_enabled}]})
- end;
+ SingleNodeConfig = config:get_boolean("couchdb", "single_node", false),
+ case SingleNodeConfig of
+ true ->
+ chttpd:send_json(Req, 200, {[{state, single_node_enabled}]});
_ ->
- case setup:is_cluster_enabled() of
- false ->
- chttpd:send_json(Req, 200, {[{state, cluster_disabled}]});
- true ->
- case setup:has_cluster_system_dbs(Dbs) of
+ case config:get("cluster", "n", undefined) of
+ "1" ->
+ case setup:is_single_node_enabled(Dbs) of
false ->
- chttpd:send_json(Req, 200, {[{state, cluster_enabled}]});
+ chttpd:send_json(Req, 200, {[{state, single_node_disabled}]});
true ->
- chttpd:send_json(Req, 200, {[{state, cluster_finished}]})
+ chttpd:send_json(Req, 200, {[{state, single_node_enabled}]})
+ end;
+ _ ->
+ case setup:is_cluster_enabled() of
+ false ->
+ chttpd:send_json(Req, 200, {[{state, cluster_disabled}]});
+ true ->
+ case setup:has_cluster_system_dbs(Dbs) of
+ false ->
+ chttpd:send_json(Req, 200, {[{state, cluster_enabled}]});
+ true ->
+ chttpd:send_json(Req, 200, {[{state, cluster_finished}]})
+ end
end
end
end;