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 <[email protected]> Authored: Wed Mar 13 01:47:34 2013 -0500 Committer: Paul J. Davis <[email protected]> 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"
