Add username/password check and append auth details to a couch db connectivity check

This commit is contained in:
Dave Conroy
2025-01-29 07:59:49 -08:00
parent 949aafdbe1
commit 78ac4a4a81

View File

@@ -943,14 +943,16 @@ backup_sqlite3() {
check_availability() { check_availability() {
if var_true "${DEBUG_CHECK_AVAILABILITY}" ; then debug on; fi if var_true "${DEBUG_CHECK_AVAILABILITY}" ; then debug on; fi
### Set the Database Type
if var_false "${backup_job_skip_availability_check}" ; then if var_false "${backup_job_skip_availability_check}" ; then
case "${dbtype}" in case "${dbtype}" in
"couch" ) "couch" )
counter=0 counter=0
code_received=0 code_received=0
if [ -n "${backup_job_db_user}" ] && [ -n ${backup_job_db_pass} ]; then
_ca_couch_auth="-u ${backup_job_db_user}:${backup_job_db_pass}"
fi
while [ "${code_received}" != "200" ]; do while [ "${code_received}" != "200" ]; do
code_received=$(run_as_user curl -XGET -sSL -o /dev/null -L -w ''%{http_code}'' ${backup_job_db_host}:${backup_job_db_port}) code_received=$(run_as_user curl -XGET -sSL -o /dev/null -L -w ''%{http_code}'' ${_ca_couch_auth} ${backup_job_db_host}:${backup_job_db_port})
if [ "${code_received}" = "200" ] ; then break ; fi if [ "${code_received}" = "200" ] ; then break ; fi
sleep 5 sleep 5
(( counter+=5 )) (( counter+=5 ))