fix: loop through lines on multiline database url set

This commit is contained in:
2024-10-22 17:29:33 -03:00
parent 40c9e1c9aa
commit a4083b67cf

View File

@@ -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