handle GET cluster state
diff --git a/src/setup.erl b/src/setup.erl
index 6374685..29576b2 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -13,6 +13,8 @@
-module(setup).
-export([enable_cluster/1, finish_cluster/0, add_node/1, receive_cookie/1]).
+-export([is_cluster_enabled/0]).
+
-include_lib("../couch/include/couch_db.hrl").
diff --git a/src/setup_httpd.erl b/src/setup_httpd.erl
index 755b951..bdb3312 100644
--- a/src/setup_httpd.erl
+++ b/src/setup_httpd.erl
@@ -11,10 +11,11 @@
% the License.
-module(setup_httpd).
+-include_lib("couch/include/couch_db.hrl").
-export([handle_setup_req/1]).
-handle_setup_req(Req) ->
+handle_setup_req(#httpd{method='POST'}=Req) ->
ok = chttpd:verify_is_server_admin(Req),
couch_httpd:validate_ctype(Req, "application/json"),
Setup = get_body(Req),
@@ -25,9 +26,16 @@
chttpd:send_json(Req, 201, {[{ok, true}]});
{error, Message} ->
couch_httpd:send_error(Req, 400, <<"bad_request">>, Message)
+ end;
+handle_setup_req(#httpd{method='GET'}=Req) ->
+ ok = chttpd:verify_is_server_admin(Req),
+ case setup:is_cluster_enabled() of
+ no ->
+ chttpd:send_json(Req, 201, {[{state, cluster_disabled}]});
+ ok ->
+ chttpd:send_json(Req, 201, {[{state, cluster_enabled}]})
end.
-
get_options(Options, Setup) ->
ExtractValues = fun({Tag, Option}, OptionsAcc) ->
case couch_util:get_value(Option, Setup) of