Skip to content

Commit

Permalink
Use new syntax for B2.
Browse files Browse the repository at this point in the history
  • Loading branch information
sKoreman committed Nov 4, 2024
1 parent 7ba6e9c commit b567243
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/backup-postgresql/backup-postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [ -z "${B2_ENCRYPTION_KEY}" ]; then
has_errors=true
fi

if [ -z "${B2_ACCOUNT_ID}" ]; then
echo "B2_ACCOUNT_ID is not set."
if [ -z "${B2_APPLICATION_KEY_ID}" ]; then
echo "B2_APPLICATION_KEY_ID is not set."
has_errors=true
fi

Expand Down Expand Up @@ -42,7 +42,7 @@ if [ "${has_errors}" = true ]; then
exit 1
fi

b2 authorize_account
b2 account authorize

DATE=$(date +"%Y-%m-%d_%H:%M:%S")

Expand All @@ -53,7 +53,7 @@ for database in $DATABASES; do
if [[ $database =~ "-prd" ]]; then
pg_dump --format=plain --no-owner --no-acl --clean -c "${database}" > "/tmp/${FILENAME}.sql"
openssl aes-256-cbc -md md5 -in "/tmp/${FILENAME}.sql" -out "/tmp/${FILENAME}.sql.encrypted" -pass "pass:${B2_ENCRYPTION_KEY}"
b2 upload_file "${B2_BUCKET}" "/tmp/${FILENAME}.sql.encrypted" "${database}/${FILENAME}.sql.encrypted"
b2 file upload "${B2_BUCKET}" "/tmp/${FILENAME}.sql.encrypted" "${database}/${FILENAME}.sql.encrypted"
rm "/tmp/${FILENAME}".*
fi
done
Expand Down

0 comments on commit b567243

Please sign in to comment.