From a4083b67cf1f4123c680873b8690495646f7a061 Mon Sep 17 00:00:00 2001 From: Lucilio Correia Date: Tue, 22 Oct 2024 17:29:33 -0300 Subject: [PATCH] fix: loop through lines on multiline database url set --- scripts/ofelia-config.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ofelia-config.sh b/scripts/ofelia-config.sh index bb3cad9..5a4194c 100755 --- a/scripts/ofelia-config.sh +++ b/scripts/ofelia-config.sh @@ -24,9 +24,9 @@ if test -z "${output_path}"; then output_path=/dev/stdout; fi -for entry in "${BACKUP_DATABASES}"; do +echo "${BACKUP_DATABASES}" | while read entry; do # normalize spaces - backup_data=$(echo ${entry} | xargs); + backup_data=$(echo "${entry}" | xargs); # skip if it is a empty line if test -z "${backup_data}"; then continue; @@ -36,7 +36,7 @@ for entry in "${BACKUP_DATABASES}"; do # remove everything before the first space to get cron label BACKUP_SCHEDULE=${backup_data#* }; # load url data as variables - dburl-parser.sh ${DB_URL} > /tmp/ofelia.dotenv; + dburl-parser.sh ${DB_URL} > /tmp/ofelia.dotenv || exit 1; source /tmp/ofelia.dotenv; rm /tmp/ofelia.dotenv; # fail if $DB_URL has no schema