Skip to content

Commit 1b4dcaf

Browse files
committed
added endpoint urls
1 parent 5f23033 commit 1b4dcaf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

database-backup.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ else
1919
exit 1
2020
fi
2121

22+
if [ -z "$ENDPOINT_URL" ]; then
23+
echo "Error: ENDPOINT_URL is missing."
24+
exit 1
25+
fi
26+
2227
if [ -z "$S3_BUCKET" ]; then
2328
echo "Error: S3_BUCKET is missing."
2429
exit 1
@@ -39,7 +44,7 @@ pg_dump "$CONNECTION_ARG" $TABLE_FLAGS -Fc -a -f "/tmp/$BACKUP_FILE"
3944

4045
echo "Backup created. Uploading to $S3_PATH..."
4146

42-
aws s3 cp "/tmp/$BACKUP_FILE" "$S3_PATH"
47+
aws s3 cp "/tmp/$BACKUP_FILE" "$S3_PATH" --endpoint-url "$ENDPOINT_URL"
4348

4449
rm "/tmp/$BACKUP_FILE"
4550

database-restore.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ else
3030
echo "Error: Input file not found locally and S3_BUCKET env var is missing."
3131
exit 1
3232
fi
33+
if [ -z "$ENDPOINT_URL" ]; then
34+
echo "Error: ENDPOINT_URL is missing."
35+
exit 1
36+
fi
3337

3438
S3_FULL_PATH="s3://${S3_BUCKET}/${S3_PREFIX}${INPUT_ARG}"
3539
RESTORE_FILE="/tmp/restore_temp.dump"
3640
SHOULD_CLEANUP=true
3741

3842
echo "Local file '$INPUT_ARG' not found. Attempting download from $S3_FULL_PATH..."
39-
aws s3 cp "$S3_FULL_PATH" "$RESTORE_FILE"
43+
aws s3 cp "$S3_FULL_PATH" "$RESTORE_FILE" --endpoint-url "$ENDPOINT_URL"
4044
fi
4145

4246
echo "Restoring data to database..."

0 commit comments

Comments
 (0)