Skip to content

Commit

Permalink
Fix assets dump bug in passing postgres password to the run func
Browse files Browse the repository at this point in the history
  • Loading branch information
andytson-inviqa committed Nov 28, 2023
1 parent 6b2b173 commit dbf95f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker/image/console/root/usr/lib/task/assets/dump.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

function task_assets_dump()
{
(
local ASSETS_DIR="${ASSETS_DIR:-tools/assets/development}"
local DUMP_COMMAND=()
local PRE_COMMAND=()
Expand All @@ -13,12 +13,12 @@ function task_assets_dump()
if [ "${DB_PLATFORM}" == "mysql" ]; then
DUMP_COMMAND=(mysqldump -h "${DB_HOST}" -u "${DB_USER}" "-p${DB_PASS}" "${DB_NAME}")
elif [ "${DB_PLATFORM}" == "postgres" ]; then
PRE_COMMAND=("PGPASSWORD=$DB_PASS")
export PGPASSWORD="$DB_PASS"
DUMP_COMMAND=(pg_dump -h "${DB_HOST}" -U "${DB_USER}" "${DB_NAME}")
elif [ -n "${DB_PLATFORM}" ]; then
(>&2 echo "invalid database type")
exit 1
fi

"${PRE_COMMAND[@]}" run "$(printf ' %q' "${DUMP_COMMAND[@]}") | gzip > '/app/${ASSETS_DIR}/${DB_NAME}.sql.gz'"
}
run "$(printf ' %q' "${DUMP_COMMAND[@]}") | gzip > '/app/${ASSETS_DIR}/${DB_NAME}.sql.gz'"
)

0 comments on commit dbf95f8

Please sign in to comment.