Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 533FE10FBB for ; Sat, 18 Jan 2014 00:48:45 +0000 (UTC) Received: (qmail 6635 invoked by uid 500); 18 Jan 2014 00:47:37 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 6290 invoked by uid 500); 18 Jan 2014 00:47:31 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 6208 invoked by uid 99); 18 Jan 2014 00:47:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jan 2014 00:47:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 621283B0BC; Sat, 18 Jan 2014 00:47:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davisp@apache.org To: commits@couchdb.apache.org Date: Sat, 18 Jan 2014 00:48:07 -0000 Message-Id: In-Reply-To: <978acd0ce5c743cc895fab78dee5f978@git.apache.org> References: <978acd0ce5c743cc895fab78dee5f978@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [42/50] git commit: Add a config:reload/0 and HTTP trigger Add a config:reload/0 and HTTP trigger Theoretically this should prevent all of those annoying test suite failures when a test fails in with a temporary config set and fails to undo its changes. This works by storing the list of INI files in the config server and on command will clear its ets table and re-read data from disk thus clearing its cache of non-persisted values. Obviously this isn't something that should be relied on in production settings. Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/48a3427c Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/48a3427c Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/48a3427c Branch: refs/heads/import Commit: 48a3427c109c3e99989c04adf681f2ad8076afb4 Parents: 78b0a2e Author: Paul J. Davis Authored: Wed Mar 13 01:47:34 2013 -0500 Committer: Paul J. Davis Committed: Fri Jan 17 16:44:32 2014 -0800 ---------------------------------------------------------------------- src/couch_httpd_misc_handlers.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/48a3427c/src/couch_httpd_misc_handlers.erl ---------------------------------------------------------------------- diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl index b8f59cd..d57ceeb 100644 --- a/src/couch_httpd_misc_handlers.erl +++ b/src/couch_httpd_misc_handlers.erl @@ -157,6 +157,11 @@ handle_config_req(#httpd{method='GET', path_parts=[_, Section, Key]}=Req) -> Value -> send_json(Req, 200, list_to_binary(Value)) end; +% POST /_config/_reload - Flushes unpersisted config values from RAM +handle_config_req(#httpd{method='POST', path_parts=[_, <<"_reload">>]}=Req) -> + ok = couch_httpd:verify_is_server_admin(Req), + ok = config:reload(), + send_json(Req, 200, {[{ok, true}]}); % PUT or DELETE /_config/Section/Key handle_config_req(#httpd{method=Method, path_parts=[_, Section, Key]}=Req) when (Method == 'PUT') or (Method == 'DELETE') -> @@ -215,7 +220,7 @@ handle_config_req(#httpd{method=Method, path_parts=[_, Section, Key]}=Req) end end; handle_config_req(Req) -> - send_method_not_allowed(Req, "GET,PUT,DELETE"). + send_method_not_allowed(Req, "GET,PUT,POST,DELETE"). % PUT /_config/Section/Key % "value"