Attempt to use env variable for backup script

This should be available via docker, and we shouldn't have the database
name hardcoded anywhere
This commit is contained in:
Joel Bradshaw 2021-12-28 13:45:39 -08:00
parent d44a900e0c
commit 879a410808

View file

@ -1,3 +1,7 @@
#!/bin/bash
if [ -z "$POSTGRES_DB" ]; then
echo "Database not specified, defaulting to bookwyrm"
fi
BACKUP_DB=${POSTGRES_DB:-bookwyrm}
filename=backup__$(date +%F)
pg_dump -U bookwyrm > /backups/$filename.sql
pg_dump -U $BACKUP_DB > /backups/$filename.sql