...

Text file src/github.com/go-kivik/kivik/v4/script/complete_couch2.sh

Documentation: github.com/go-kivik/kivik/v4/script

     1#!/bin/sh -e
     2
     3for db in _users _replicator _global_changes; do
     4echo ${1}/${db}
     5    status=$(curl --silent --write-out "%{http_code}" -o /dev/null -u ${COUCHDB_USER}:${COUCHDB_PASSWORD} -X PUT "${1}/${db}")
     6    case ${status} in
     7        2*)
     8            # Success!
     9        ;;
    10        412)
    11            # Already exists, nothing to do.
    12        ;;
    13        *)
    14            echo "Failed to create ${db}: ${status}"
    15            exit 1
    16        ;;
    17    esac
    18done
    19curl --silent --fail -o /dev/null -u ${COUCHDB_USER}:${COUCHDB_PASSWORD} -X PUT "${1}/_node/nonode@nohost/_config/replicator/interval" -d '"1000"'
    20curl --silent --fail -o /dev/null -u ${COUCHDB_USER}:${COUCHDB_PASSWORD} -X PUT "${1}/_node/nonode@nohost/_config/cluster/n" -d '"1"'

View as plain text