Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
handle GET cluster state
  • Loading branch information
janl committed Nov 14, 2014
1 parent 3304add commit 14e0374429b654e0779e7c0c7dd739289728e682
Showing 2 changed files with 12 additions and 2 deletions.
@@ -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").


@@ -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 @@ handle_setup_req(Req) ->
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

0 comments on commit 14e0374

Please sign in to comment.