From edb7e88c94434f477b3e4eff5cc4608c86316b44 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Mon, 13 Mar 2017 20:41:14 +0100 Subject: [PATCH 1/3] Update _config endpoint documentation to reflect new location --- src/api/server/configuration.rst | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/api/server/configuration.rst b/src/api/server/configuration.rst index 4b120d25..f0e293ee 100644 --- a/src/api/server/configuration.rst +++ b/src/api/server/configuration.rst @@ -19,10 +19,10 @@ Configuration The CouchDB Server Configuration API provide an interface to query and update the various configuration values within a running CouchDB instance. -``/_config`` -============ +``/_node/{node-name}/_config`` +============================== -.. http:get:: /_config +.. http:get:: /_node/{node-name}/_config :synopsis: Obtains a list of the entire server configuration Returns the entire CouchDB server configuration as a JSON structure. The @@ -40,7 +40,7 @@ the various configuration values within a running CouchDB instance. .. code-block:: http - GET /_config HTTP/1.1 + GET /_node/nonode@nohost/_config HTTP/1.1 Accept: application/json Host: localhost:5984 @@ -152,12 +152,15 @@ the various configuration values within a running CouchDB instance. } } +.. versionchanged: 2.0.0 The config endpoint from ``/_config`` to + ``/_node/{node-name}/_config``. + .. _api/config/section: -``/_config/section`` -==================== +``_node/{node-name}/_config/section`` +===================================== -.. http:get:: /_config/{section} +.. http:get:: /_node/{node-name}/_config/{section} :synopsis: Returns all the configuration values for the specified section Gets the configuration structure for a single section. @@ -174,7 +177,7 @@ the various configuration values within a running CouchDB instance. .. code-block:: http - GET /_config/httpd HTTP/1.1 + GET /_node/nonode@nohost/_config/httpd HTTP/1.1 Accept: application/json Host: localhost:5984 @@ -203,10 +206,10 @@ the various configuration values within a running CouchDB instance. .. _api/config/section/key: -``/_config/section/key`` -======================== +``/_node/node/_config/section/key`` +=================================== -.. http:get:: /_config/{section}/{key} +.. http:get:: /_node/{node-name}/_config/{section}/{key} :synopsis: Returns a specific section/configuration value Gets a single configuration value from within a specific configuration @@ -225,7 +228,7 @@ the various configuration values within a running CouchDB instance. .. code-block:: http - GET /_config/log/level HTTP/1.1 + GET /_node/nonode@nohost/_config/log/level HTTP/1.1 Accept: application/json Host: localhost:5984 @@ -247,7 +250,7 @@ the various configuration values within a running CouchDB instance. or numeric value, or an array or object. Some client environments may not parse simple strings or numeric values as valid JSON. -.. http:put:: /_config/{section}/{key} +.. http:put:: /_node/{node-name}/_config/{section}/{key} :synopsis: Sets the specified configuration value Updates a configuration value. The new value should be supplied in the @@ -271,7 +274,7 @@ the various configuration values within a running CouchDB instance. .. code-block:: http - PUT /_config/log/level HTTP/1.1 + PUT /_node/nonode@nohost/_config/log/level HTTP/1.1 Accept: application/json Content-Length: 7 Content-Type: application/json @@ -292,7 +295,7 @@ the various configuration values within a running CouchDB instance. "debug" -.. http:delete:: /_config/{section}/{key} +.. http:delete:: /_node/{node-name}/_config/{section}/{key} :synopsis: Removes the current setting Deletes a configuration value. The returned JSON will be the value of the @@ -312,7 +315,7 @@ the various configuration values within a running CouchDB instance. .. code-block:: http - DELETE /_config/log/level HTTP/1.1 + DELETE /_node/nonode@nohost/_config/log/level HTTP/1.1 Accept: application/json Host: localhost:5984 From 1d78a1379e4610d06224d5f63ffb06c45a118cae Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Wed, 15 Mar 2017 10:11:10 +0100 Subject: [PATCH 2/3] Update config examples and other references --- src/api/server/common.rst | 2 +- src/config/auth.rst | 9 +++++---- src/config/intro.rst | 4 ++-- src/intro/security.rst | 13 ++++++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/api/server/common.rst b/src/api/server/common.rst index f7d9be5f..e0aee09a 100644 --- a/src/api/server/common.rst +++ b/src/api/server/common.rst @@ -1036,7 +1036,7 @@ could be changed to ``random`` by sending this HTTP request: .. code-block:: http - PUT http://couchdb:5984/_config/uuids/algorithm HTTP/1.1 + PUT http://couchdb:5984/_node/nonode@nohost/_config/uuids/algorithm HTTP/1.1 Content-Type: application/json Accept: */* diff --git a/src/config/auth.rst b/src/config/auth.rst index f1f99241..50c8d749 100644 --- a/src/config/auth.rst +++ b/src/config/auth.rst @@ -42,12 +42,13 @@ Server Administrators CouchDB is restarted, the passwords will be salted and encrypted. You may also use the HTTP interface to create administrator accounts; this way, you don't need to restart CouchDB, and there's no need to temporarily store - or transmit passwords in plaintext. The HTTP ``_config/admins`` endpoint - supports querying, deleting or creating new admin accounts: + or transmit passwords in plaintext. The HTTP + ``/_node/{node-name}/_config/admins`` endpoint supports querying, deleting + or creating new admin accounts: .. code-block:: http - GET /_config/admins HTTP/1.1 + GET /_node/nonode@nohost/_config/admins HTTP/1.1 Accept: application/json Host: localhost:5984 @@ -74,7 +75,7 @@ Server Administrators .. code-block:: http - PUT /_config/admins/architect?raw=true HTTP/1.1 + PUT /_node/nonode@nohost/_config/admins/architect?raw=true HTTP/1.1 Accept: application/json Content-Type: application/json Content-Length: 89 diff --git a/src/config/intro.rst b/src/config/intro.rst index cd31fe09..157a4b5e 100644 --- a/src/config/intro.rst +++ b/src/config/intro.rst @@ -156,7 +156,7 @@ Alternatively, configuration parameters could be set via the :ref:`HTTP API `. This API allows to change CouchDB configuration on-the-fly without requiring a server restart:: - curl -X PUT http://localhost:5984/_config/uuids/algorithm -d '"random"' + curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/uuids/algorithm -d '"random"' In the response the old parameter's value returns:: @@ -166,7 +166,7 @@ You should be careful with changing configuration via the HTTP API since it's easy to make CouchDB unavailable. For instance, if you'd like to change the :option:`httpd/bind_address` for a new one:: - curl -X PUT http://localhost:5984/_config/httpd/bind_address -d '"10.10.0.128"' + curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/httpd/bind_address -d '"10.10.0.128"' However, if you make a typo, or the specified IP address is not available from your network, CouchDB will be unavailable for you in both cases and diff --git a/src/intro/security.rst b/src/intro/security.rst index 03305471..09fde5b1 100644 --- a/src/intro/security.rst +++ b/src/intro/security.rst @@ -71,9 +71,10 @@ identification for certain requests: - Triggering compaction (:post:`POST /database/_compact `) - Reading the task status list (:get:`GET /_active_tasks `) - Restarting the server (:post:`POST /_restart `) -- Reading the active configuration (:get:`GET /_config `) -- Updating the active configuration (:put:`PUT /_config/section/key - `) +- Reading the active configuration + (:get:`GET /_node/{node-name}/_config `) +- Updating the active configuration + (:put:`PUT /_node/{node-name}/_config/section/key `) Creating New Admin User ^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +91,7 @@ create an admin user. We'll call her ``anna``, and her password is ``secret``. Note the double quotes in the following code; they are needed to denote a string value for the :ref:`configuration API `:: - > curl -X PUT $HOST/_config/admins/anna -d '"secret"' + > curl -X PUT $HOST/_node/$NODENAME/_config/admins/anna -d '"secret"' "" As per the :ref:`_config ` API's behavior, we're getting @@ -470,7 +471,9 @@ Now let's share the field ``name``. First, set up the ``public_fields`` configuration option. Remember, that this action requires administrator privileges. The next command will prompt you for user `admin`'s password: - curl -X PUT http://localhost:5984/_config/couch_httpd_auth/public_fields \ +.. code-block:: bash + + curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/couch_httpd_auth/public_fields \ -H "Content-Type: application/json" \ -d '"name"' \ -u admin From f6ada017aa9fa25f490c0c2563dfa15d8af5eeaa Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Wed, 15 Mar 2017 10:22:20 +0100 Subject: [PATCH 3/3] Mention /_config move in Whatsnew document --- src/whatsnew/2.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/whatsnew/2.0.rst b/src/whatsnew/2.0.rst index 6640c7c1..e7748047 100644 --- a/src/whatsnew/2.0.rst +++ b/src/whatsnew/2.0.rst @@ -66,6 +66,8 @@ Version 2.0.0 * Support added for Erlang/OTP 17.x, 18.x and 19 * New streamlined build system written for Unix-like systems and Microsoft Windows +* :ref:`Configuration ` has moved from ``/_config`` to + ``/_node/{node-name}/_config`` .. _release/2.0.x/upgrade: