File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,14 +70,14 @@ mkdir -p "$BACKUP_DIR"
7070BACKUP_TIMESTAMP=$( date ' +%Y%m%d_%H%M%S' )
7171BACKUP_FILE=" $BACKUP_DIR /codecrow_pre_deploy_${BACKUP_TIMESTAMP} .sql.gz"
7272
73- # Read DB credentials from .env
73+ # Read DB credentials from .env (grep instead of source to avoid
74+ # unbound-variable errors from passwords containing $ characters)
7475DB_NAME=" codecrow_ai"
7576DB_USER=" codecrow_user"
7677if [ -f " $DEPLOY_DIR /.env" ]; then
77- # shellcheck disable=SC1091
78- set -a; source " $DEPLOY_DIR /.env" ; set +a
79- DB_NAME=" ${POSTGRES_DB:- codecrow_ai} "
80- DB_USER=" ${POSTGRES_USER:- codecrow_user} "
78+ _val=$( grep -m1 ' ^POSTGRES_DB=' " $DEPLOY_DIR /.env" | cut -d' =' -f2- | tr -d ' [:space:]' ) && [ -n " $_val " ] && DB_NAME=" $_val "
79+ _val=$( grep -m1 ' ^POSTGRES_USER=' " $DEPLOY_DIR /.env" | cut -d' =' -f2- | tr -d ' [:space:]' ) && [ -n " $_val " ] && DB_USER=" $_val "
80+ unset _val
8181fi
8282
8383if docker compose -f " $COMPOSE_FILE " ps --status running 2> /dev/null | grep -q postgres; then
You can’t perform that action at this time.
0 commit comments