Use .env file for backup configuration #1

Open
skobkin wants to merge 17 commits from pg_backup_dotenv into main
Showing only changes of commit eee9995248 - Show all commits

View file

@ -54,9 +54,11 @@ for PREFIX in $DATABASE_PREFIXES; do
# Perform the backup based on the specified format
if [[ "$DUMP_FORMAT" == "custom" ]]; then
pg_dump -h "$HOST" -p "$PORT" -U "$USER" -Fc "$DB_NAME" -f "$BACKUP_FILE"
# Custom format and highest ZSTD compression level
pg_dump -h "$HOST" -p "$PORT" -U "$USER" -Fc --compress="zstd:21" "$DB_NAME" -f "$BACKUP_FILE"
elif [[ "$DUMP_FORMAT" == "sql" ]]; then
pg_dump -h "$HOST" -p "$PORT" -U "$USER" "$DB_NAME" | gzip > "$BACKUP_FILE"
# Plain-text SQL backup compressed with gzip at high compression level
pg_dump -h "$HOST" -p "$PORT" -U "$USER" "$DB_NAME" | gzip -9 > "$BACKUP_FILE"
else
echo "Invalid DUMP_FORMAT for $PREFIX: $DUMP_FORMAT. Skipping..."
continue