Skip to content

Commit 290ea87

Browse files
jiahuili430nickva
authored andcommitted
docs: add adm:pass to URL examples
fix #4642
1 parent be2eecc commit 290ea87

14 files changed

Lines changed: 55 additions & 55 deletions

File tree

src/docs/src/api/database/security.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143

144144
.. code-block:: bash
145145
146-
shell> curl http://localhost:5984/pineapple/_security -X PUT -H 'content-type: application/json' -H 'accept: application/json' -d '{"admins":{"names":["superuser"],"roles":["admins"]},"members":{"names": ["user1","user2"],"roles": ["developers"]}}'
146+
shell> curl http://adm:pass@localhost:5984/pineapple/_security -X PUT -H 'content-type: application/json' -H 'accept: application/json' -d '{"admins":{"names":["superuser"],"roles":["admins"]},"members":{"names": ["user1","user2"],"roles": ["developers"]}}'
147147
148148
.. code-block:: http
149149

src/docs/src/api/document/attachments.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,29 +278,29 @@ database:
278278

279279
.. code-block:: bash
280280
281-
shell> curl -X PUT http://127.0.0.1:5984/test
281+
shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test
282282
{"ok":true}
283283
284284
Then we create a new document and the file attachment in one go:
285285

286286
.. code-block:: bash
287287
288-
shell> curl -X PUT http://127.0.0.1:5984/test/doc/file.txt \
288+
shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test/doc/file.txt \
289289
-H "Content-Type: application/octet-stream" -d@file.txt
290290
{"ok":true,"id":"doc","rev":"1-287a28fa680ae0c7fb4729bf0c6e0cf2"}
291291
292292
Now we can request the whole file easily:
293293

294294
.. code-block:: bash
295295
296-
shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt
296+
shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt
297297
My hovercraft is full of eels!
298298
299299
But say we only want the first 13 bytes:
300300

301301
.. code-block:: bash
302302
303-
shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt \
303+
shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt \
304304
-H "Range: bytes=0-12"
305305
My hovercraft
306306

src/docs/src/best-practices/forms.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ Here's the worked sample above, using ``curl`` to simulate the form POST.
111111

112112
.. code-block:: bash
113113
114-
$ curl -X PUT localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }'
114+
$ curl -X PUT adm:pass@localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }'
115115
{"ok":true,"id":"_design/myddoc","rev":"1-2a2b0951fcaf7287817573b03bba02ed"}
116116
117-
$ curl --data "name=Lin&email=lin@example.com&message=I Love CouchDB" http://localhost:5984/testdb/_design/myddoc/_update/contactform
117+
$ curl --data "name=Lin&email=lin@example.com&message=I Love CouchDB" http://adm:pass@localhost:5984/testdb/_design/myddoc/_update/contactform
118118
* Trying 127.0.0.1...
119119
* TCP_NODELAY set
120120
* Connected to localhost (127.0.0.1) port 5984 (#1)
@@ -139,5 +139,5 @@ Here's the worked sample above, using ``curl`` to simulate the form POST.
139139
* Connection #1 to host localhost left intact
140140
{"success":"ok"}
141141
142-
$ curl http://localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z
142+
$ curl http://adm:pass@localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z
143143
{"_id":"lin@example.com_2018-04-05T19:51:22.278Z","_rev":"1-34483732407fcc6cfc5b60ace48b9da9","name":"Lin","email":"lin@example.com","message":"I Love CouchDB"}

src/docs/src/best-practices/iso-date.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ simply use ``group_level`` to zoom in on whatever time you wish to use.
3333

3434
.. code-block:: bash
3535
36-
curl -X GET "http://localhost:5984/transactions/_design/widget_count/_view/toss?group_level=1"
36+
curl -X GET "http://adm:pass@localhost:5984/transactions/_design/widget_count/_view/toss?group_level=1"
3737
3838
{"rows":[
3939
{"key":[20],"value":10},
4040
{"key":[21],"value":20}
4141
]}
4242
43-
curl -X GET "http://localhost:5984/transactions/_design/widget_count/_view/toss?group_level=2"
43+
curl -X GET "http://adm:pass@localhost:5984/transactions/_design/widget_count/_view/toss?group_level=2"
4444
4545
{"rows":[
4646
{"key":[20,widget],"value":10},

src/docs/src/cluster/sharding.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ First, retrieve the database's current metadata:
421421

422422
.. code-block:: bash
423423
424-
$ curl http://localhost/_node/_local/_dbs/{name}
424+
$ curl http://adm:pass@localhost:5984/_node/_local/_dbs/{name}
425425
{
426426
"_id": "{name}",
427427
"_rev": "1-e13fb7e79af3b3107ed62925058bfa3a",
@@ -532,7 +532,7 @@ Now you can ``PUT`` this new metadata:
532532

533533
.. code-block:: bash
534534
535-
$ curl -X PUT http://localhost/_node/_local/_dbs/{name} -d '{...}'
535+
$ curl -X PUT http://adm:pass@localhost:5984/_node/_local/_dbs/{name} -d '{...}'
536536
537537
.. _cluster/sharding/sync:
538538

@@ -643,7 +643,7 @@ Do this for all of the nodes in your cluster. For example:
643643

644644
.. code-block:: bash
645645
646-
$ curl -X PUT http://localhost/_node/_local/_nodes/{node-name} \
646+
$ curl -X PUT http://adm:pass@localhost:5984/_node/_local/_nodes/{node-name} \
647647
-d '{ \
648648
"_id": "{node-name}",
649649
"_rev": "{rev}",

src/docs/src/config/intro.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Alternatively, configuration parameters can be set via the
151151
:ref:`HTTP API <api/config>`. This API allows changing CouchDB configuration
152152
on-the-fly without requiring a server restart::
153153

154-
curl -X PUT http://localhost:5984/_node/<name@host>/_config/uuids/algorithm -d '"random"'
154+
curl -X PUT http://adm:pass@localhost:5984/_node/<name@host>/_config/uuids/algorithm -d '"random"'
155155

156156
The old parameter's value is returned in the response::
157157

@@ -161,7 +161,7 @@ You should be careful changing configuration via the HTTP API since it's
161161
possible to make CouchDB unreachable, for example, by changing the
162162
:option:`chttpd/bind_address`::
163163

164-
curl -X PUT http://localhost:5984/_node/<name@host>/_config/chttpd/bind_address -d '"10.10.0.128"'
164+
curl -X PUT http://adm:pass@localhost:5984/_node/<name@host>/_config/chttpd/bind_address -d '"10.10.0.128"'
165165

166166
If you make a typo or the specified IP address is not available from your
167167
network, CouchDB will be unreachable. The only way to resolve this will be
@@ -182,4 +182,4 @@ cluster, as a convenience, you can use the literal string ``_local`` in place
182182
of the node name, to interact with the local node's configuration. For
183183
example::
184184

185-
curl -X PUT http://localhost:5984/_node/_local/_config/uuids/algorithm -d '"random"'
185+
curl -X PUT http://adm:pass@localhost:5984/_node/_local/_config/uuids/algorithm -d '"random"'

src/docs/src/ddocs/views/collation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ You can demonstrate the collation sequence for 7-bit ASCII characters like this:
179179
require 'restclient'
180180
require 'json'
181181
182-
DB="http://127.0.0.1:5984/collator"
182+
DB="http://adm:pass@127.0.0.1:5984/collator"
183183
184184
RestClient.delete DB rescue nil
185185
RestClient.put "#{DB}",""

src/docs/src/ddocs/views/pagination.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Paging
129129
To get the first five rows from the view result, you use the ``?limit=5``
130130
query parameter::
131131

132-
curl -X GET http://127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5
132+
curl -X GET 'http://adm:pass@127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5'
133133

134134
The result:
135135

@@ -156,7 +156,7 @@ we can determine if there are more pages to display. We also know by the
156156
157157
So we query CouchDB with::
158158

159-
curl -X GET 'http://127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5&skip=5'
159+
curl -X GET 'http://adm:pass@127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5&skip=5'
160160

161161
Note we have to use ``'`` (single quotes) to escape the ``&`` character that is
162162
special to the shell we execute curl in.

src/docs/src/intro/api.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ easy to make)::
613613

614614
Now we can use the database `albums-replica` as a replication target::
615615

616-
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \
617-
-d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://adm:pass@127.0.0.1:5984/albums-replica"}' \
616+
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \
617+
-d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://admin:password@127.0.0.1:5984/albums-replica"}' \
618618
-H "Content-Type: application/json"
619619

620620
.. note::
@@ -681,8 +681,8 @@ and target members of our replication request are actually links (like in
681681
HTML) and so far we've seen links relative to the server we're working on
682682
(hence local). You can also specify a remote database as the target::
683683

684-
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \
685-
-d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \
684+
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \
685+
-d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \
686686
-H "Content-Type:application/json"
687687

688688
Using a *local source* and a *remote target* database is called *push
@@ -700,14 +700,14 @@ You can also use a *remote source* and a *local target* to do a *pull
700700
replication*. This is great for getting the latest changes from a server that
701701
is used by others::
702702

703-
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \
704-
-d '{"source":"http://user:password@example.org:5984/albums-replica","target":"http://adm:pass@127.0.0.1:5984/albums"}' \
703+
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \
704+
-d '{"source":"http://user:password@example.org:5984/albums-replica","target":"http://admin:password@127.0.0.1:5984/albums"}' \
705705
-H "Content-Type:application/json"
706706

707707
Finally, you can run remote replication, which is mostly useful for management
708708
operations::
709709

710-
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \
710+
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \
711711
-d '{"source":"http://user:password@example.org:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \
712712
-H "Content-Type: application/json"
713713

src/docs/src/intro/curl.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ to get the database information:
2626

2727
.. code-block:: bash
2828
29-
shell> curl http://admin:password@127.0.0.1:5984
29+
shell> curl http://127.0.0.1:5984
3030
3131
This returns the database information (formatted in the output below for
3232
clarity):
@@ -65,13 +65,13 @@ clarity):
6565

6666
.. code-block:: bash
6767
68-
shell> curl -X PUT 'http://127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}'
68+
shell> curl -X PUT 'http://adm:pass@127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}'
6969
7070
you should replace it with:
7171

72-
.. code-blocK:: bash
72+
.. code-block:: bash
7373
74-
shell> curl -X PUT "http://127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}"
74+
shell> curl -X PUT "http://adm:pass@127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}"
7575
7676
If you prefer, ``^"`` and ``\"`` may be used to escape the double-quote
7777
character in quoted strings instead.
@@ -82,15 +82,15 @@ URL you send using a PUT request:
8282

8383
.. code-block:: bash
8484
85-
shell> curl -X PUT http://user:pass@127.0.0.1:5984/demo
85+
shell> curl -X PUT http://adm:pass@127.0.0.1:5984/demo
8686
{"ok":true}
8787
8888
But to obtain the database information you use a ``GET`` request (with
8989
the return information formatted for clarity):
9090

9191
.. code-block:: bash
9292
93-
shell> curl -X GET http://user:pass@127.0.0.1:5984/demo
93+
shell> curl -X GET http://adm:pass@127.0.0.1:5984/demo
9494
{
9595
"compact_running" : false,
9696
"doc_count" : 0,
@@ -120,7 +120,7 @@ submit a simple document to the ``demo`` database:
120120
.. code-block:: bash
121121
122122
shell> curl -H 'Content-Type: application/json' \
123-
-X POST http://user:pass@127.0.0.1:5984/demo \
123+
-X POST http://adm:pass@127.0.0.1:5984/demo \
124124
-d '{"company": "Example, Inc."}'
125125
{"ok":true,"id":"8843faaf0b831d364278331bc3001bd8",
126126
"rev":"1-33b9fbce46930280dab37d672bbc8bb9"}
@@ -133,7 +133,7 @@ that was returned:
133133

134134
.. code-block:: bash
135135
136-
shell> curl -X GET http://user:pass@127.0.0.1:5984/demo/8843faaf0b831d364278331bc3001bd8
136+
shell> curl -X GET http://adm:pass@127.0.0.1:5984/demo/8843faaf0b831d364278331bc3001bd8
137137
{"_id":"8843faaf0b831d364278331bc3001bd8",
138138
"_rev":"1-33b9fbce46930280dab37d672bbc8bb9",
139139
"company":"Example, Inc."}

0 commit comments

Comments
 (0)