FAQ
add maintainance handler


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/f26c6689
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/f26c6689
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/f26c6689

Branch: refs/heads/1994-merge-rcouch
Commit: f26c6689fd78ffb77fd5c07f826308eb86db63f8
Parents: b897545
Author: benoitc <bchesneau@gmail.com>
Authored: Tue Jul 8 13:17:42 2014 +0200
Committer: benoitc <bchesneau@gmail.com>
Committed: Sun Jul 13 14:33:20 2014 +0200

----------------------------------------------------------------------
  src/couch_httpd_misc_handlers.erl | 17 ++++++++++++++---
  1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/f26c6689/src/couch_httpd_misc_handlers.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl
index 293ef00..26fd75c 100644
--- a/src/couch_httpd_misc_handlers.erl
+++ b/src/couch_httpd_misc_handlers.erl
@@ -13,9 +13,10 @@
  -module(couch_httpd_misc_handlers).

  -export([handle_welcome_req/2,handle_favicon_req/2,handle_utils_dir_req/2,
- handle_all_dbs_req/1,handle_restart_req/1,
- handle_uuids_req/1,handle_config_req/1,handle_log_req/1,
- handle_task_status_req/1, handle_file_req/2]).
+ handle_all_dbs_req/1,handle_restart_req/1,
+ handle_uuids_req/1,handle_config_req/1,handle_log_req/1,
+ handle_task_status_req/1, handle_file_req/2,
+ handle_up_req/1]).

  -export([increment_update_seq_req/2]).

@@ -316,3 +317,13 @@ handle_log_req(#httpd{method='POST'}=Req) ->
      end;
  handle_log_req(Req) ->
      send_method_not_allowed(Req, "GET,POST").
+
+handle_up_req(#httpd{method='GET'} = Req) ->
+ case couch_config:get("couchdb", "maintenance_mode") of
+ "true" ->
+ couch_httpd:send_json(Req, 404, {[{status, maintenance_mode}]});
+ _ ->
+ couch_httpd:send_json(Req, 200, {[{status, ok}]})
+ end;
+handle_up_req(Req) ->
+ couch_httpd:send_method_not_allowed(Req, "GET,HEAD").

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 10 | next ›
Discussion Overview
groupcommits @
categoriescouchdb
postedJul 13, '14 at 12:34p
activeJul 13, '14 at 12:34p
posts10
users1
websitecouchdb.apache.org
irc#couchdb

1 user in discussion

Benoitc: 10 posts

People

Translate

site design / logo © 2021 Grokbase