From 78ac4a4a81f60cda03a25ce8b4225be998953586 Mon Sep 17 00:00:00 2001 From: Dave Conroy Date: Wed, 29 Jan 2025 07:59:49 -0800 Subject: [PATCH] Add username/password check and append auth details to a couch db connectivity check --- install/assets/functions/10-db-backup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install/assets/functions/10-db-backup b/install/assets/functions/10-db-backup index a60a8c0..25d1cd6 100644 --- a/install/assets/functions/10-db-backup +++ b/install/assets/functions/10-db-backup @@ -943,14 +943,16 @@ backup_sqlite3() { check_availability() { if var_true "${DEBUG_CHECK_AVAILABILITY}" ; then debug on; fi - ### Set the Database Type if var_false "${backup_job_skip_availability_check}" ; then case "${dbtype}" in "couch" ) counter=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 - 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 sleep 5 (( counter+=5 ))