Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

simplicate

1.3.3 • Public • Published

simplicate

As well as triggering replication from the command line, also useful for generating curl commands that you can share with others.

At its simplest:

simplicate -s http://couch.mammal.io:5984/foo_db

maps to the following curl command which is displayed for your confirmation.

curl -s -f --output /dev/null --write-out %{http_code} \
  -H 'Content-Type: application/json' \
  -X POST http://127.0.0.1:5984/_replicate \
  -d '{"source":"http://couch.mammal.io:5984/foo_db","target":"foo_db","create_target":true}'

Supports filters, query-params, doc_ids, continuous replication.

Exits with error code 1 when replication fails.

Install

With npm:

npm install -g simplicate

or manually:

git clone https://github.com/aslant/simplicate.git
ln -s `pwd`/simplicate/simplicate.sh /usr/local/bin/simplicate

It's a bash script. Depends on curl.

Usage

simplicate -s <src> | -t <tar>  [-d <doc_ids>] [-f <filter> [-q <query_params>]] [-c] [-v] [-y] [<couch_server>]
OPTIONS

<couch_server>
  The CouchDB Server to which the /_replicate request is posted.
  Defaults to http://127.0.0.1:5984

-s <src>
-t <tar>
  One or both of source and target must be supplied.
  Where only one is specified, it should be the full URL to the database.
  In this case it is inferred that the other database - on <couch_server> - 
  will have the same name.

-d <doc_ids>
  Replicate only documents with supplied ids.
  e.g. -d '[ "id1", "id2" ]'

-f <filter>
  Apply a filter function when replicating.
  e.g. -f a_design_doc/some_filter_fn

-q <query_params>
  Query parameters can be supplied to the filter function.
  e.g. -f a_design_doc/some_filter_fn -q '{ "aKey": "aVal" }'

-c
  Continuous replication

-v
  Run `curl` with verbose flag

-y
  Assume yes - curl command executed without confirmation.

---

N.B. create_target is always set to true.

Abbreviated URLs

If a port is supplied but the protocol and hostname are both omitted, then the protocol and hostname are inferred as http://127.0.0.1.

For example :9999/foo_db is mapped to http://127.0.0.1:9999/foo_db, :8888 is mapped to http://127.0.0.1:8888.

install

npm i simplicate

Downloadsweekly downloads

1

version

1.3.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability