Use .env file for backup configuration
This commit is contained in:
parent
21eeaf66ee
commit
d1d11c4668
|
@ -1,14 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Configuration
|
# Load environment variables from .env file
|
||||||
HOST="localhost"
|
if [ -f .env ]; then
|
||||||
PORT="5432"
|
export $(grep -v '^#' .env | xargs)
|
||||||
USER="your_postgres_user"
|
else
|
||||||
BACKUP_PATH="/path/to/backup/directory"
|
echo ".env file not found! Please create it with the necessary configuration."
|
||||||
DUMP_FORMAT="custom" # Set to "custom" for .dump or "sql" for plaintext SQL
|
exit 1
|
||||||
EXTENSION="dump" # Default extension
|
fi
|
||||||
|
|
||||||
# Adjust file extension based on dump format
|
# Set file extension based on DUMP_FORMAT
|
||||||
|
EXTENSION="dump" # Default extension for custom format
|
||||||
if [[ "$DUMP_FORMAT" == "sql" ]]; then
|
if [[ "$DUMP_FORMAT" == "sql" ]]; then
|
||||||
EXTENSION="sql.gz"
|
EXTENSION="sql.gz"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue