updated couchdb_scripts_defaults.conf, allow custom defaults file
authorroot <root@urchin.dev.bitmask.net>
Wed, 30 Oct 2013 23:38:41 +0000 (23:38 +0000)
committervarac <varacanero@zeromail.org>
Wed, 30 Oct 2013 23:39:39 +0000 (23:39 +0000)
couchdb_scripts_defaults.conf

index e7ad685..133feb7 100644 (file)
@@ -1,19 +1,23 @@
-NETRC_FILE='/etc/couchdb/couchdb.netrc'
-
-OPTS="--netrc-file $NETRC_FILE -HContent-Type:application/json -s"
-CURL="curl $OPTS "
+NETRC_FILE="${HOME}/.netrc"
 
 # wget needs --auth-no-challenge, see bugs.debian.org/600169
+# wget doesn't accept a custom netrc location (like curl does), 
+# please make sure to provide a ~/.netrc
 WGET_OPTS='--auth-no-challenge -q -O -'
 
+# todo: move from curl to wget
+CURL_OPTS="--netrc -HContent-Type:application/json -s"
+CURL="curl $CURL_OPTS "
 
 URL='http://127.0.0.1:5984'
-BACKEND_URL='http://127.0.0.1:5986'
 DUMPDIR='/var/backups/couchdb'
 TMPPREFIX='tmp'
 
-# replication uses 
-user=`cat /etc/couchdb/couchdb.netrc | cut -d ' ' -f 4`
-pw=`cat /etc/couchdb/couchdb.netrc | cut -d ' ' -f 6`
-auth_url="http://${user}:${pw}@127.0.0.1:5984"
+# only used for replication
+BACKEND_URL='http://127.0.0.1:5986'
+couchdb_user=`cat $NETRC_FILE | cut -d ' ' -f 4`
+couchdb_pw=`cat $NETRC_FILE | cut -d ' ' -f 6`
+couchdb_auth_url="http://${couchdb_user}:${couchdb_pw}@127.0.0.1:5984"
 
+# source custom defaults if present
+[ -f "${HOME}/.couchdb_scripts_defaults.conf" ] && . "${HOME}/.couchdb_scripts_defaults.conf"