mirror of
https://github.com/prodrigestivill/docker-postgres-backup-local.git
synced 2026-05-31 08:37:58 +00:00
Add support for docker secrets
Check if password file ENV variable POSTGRES_PASSWORD_FILE is set (for use with docker secrets, point this to /run/secrets/<name of secret>). If it is not set, fallback to POSTGRES_PASSWORD ENV variable.
This commit is contained in:
@@ -28,7 +28,11 @@ if [ "${POSTGRES_PASSWORD}" = "**None**" ]; then
|
||||
fi
|
||||
|
||||
#Proces vars
|
||||
export PGPASSWORD=$POSTGRES_PASSWORD
|
||||
if [ "${POSTGRES_PASSWORD_FILE}" = "**None**" ]; then
|
||||
export PGPASSWORD=$POSTGRES_PASSWORD
|
||||
else
|
||||
export PGPASSWORD=$(cat ${POSTGRES_PASSWORD_FILE})
|
||||
fi
|
||||
POSTGRES_HOST_OPTS="-h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER $POSTGRES_EXTRA_OPTS"
|
||||
KEEP_DAYS=$BACKUP_KEEP_DAYS
|
||||
KEEP_WEEKS=`expr $((($BACKUP_KEEP_WEEKS * 7) + 1))`
|
||||
|
||||
Reference in New Issue
Block a user