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 a2f25f51a8 - Show all commits

View file

@ -49,8 +49,6 @@ for PREFIX in $DATABASE_PREFIXES; do
# Loop over each database and create a backup # Loop over each database and create a backup
for DB_NAME in $DATABASES; do for DB_NAME in $DATABASES; do
echo "Starting backup for database '$DB_NAME' on $HOST:$PORT..."
# Set file extension based on DUMP_FORMAT # Set file extension based on DUMP_FORMAT
EXTENSION="dump" EXTENSION="dump"
if [[ "$DUMP_FORMAT" == "sql" ]]; then if [[ "$DUMP_FORMAT" == "sql" ]]; then
@ -59,7 +57,8 @@ for PREFIX in $DATABASE_PREFIXES; do
# Set backup file path within the server-specific directory # Set backup file path within the server-specific directory
BACKUP_FILE="$SERVER_DIR/$DB_NAME.$EXTENSION" BACKUP_FILE="$SERVER_DIR/$DB_NAME.$EXTENSION"
echo "Backup file: $BACKUP_FILE"
echo "Dumping '$DB_NAME' on $HOST:$PORT to $BACKUP_FILE"
# Perform the backup based on the specified format # Perform the backup based on the specified format
if [[ "$DUMP_FORMAT" == "custom" ]]; then if [[ "$DUMP_FORMAT" == "custom" ]]; then
@ -71,7 +70,7 @@ for PREFIX in $DATABASE_PREFIXES; do
continue continue
fi fi
echo "Backup for database '$DB_NAME' on $HOST:$PORT completed successfully." du -sh $BACKUP_FILE
done done
done done