Skip to content

Commit

Permalink
devops: Fix PGUSER override
Browse files Browse the repository at this point in the history
  • Loading branch information
jhf committed Nov 29, 2024
1 parent 0c90264 commit 63c2bfe
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions devops/manage-statbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ EOS
PGHOST=127.0.0.1
PGPORT=$(./devops/dotenv --file .env get DB_PUBLIC_LOCALHOST_PORT)
PGDATABASE=$(./devops/dotenv --file .env get POSTGRES_DB)
PGUSER=postgres
# Preserve the USER if already setup, to allow overrides.
PGUSER=${PGUSER:-postgres}
PGPASSWORD=$(./devops/dotenv --file .env get POSTGRES_PASSWORD)
cat <<EOS
export PGHOST=$PGHOST PGPORT=$PGPORT PGDATABASE=$PGDATABASE PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD
Expand All @@ -569,10 +570,7 @@ EOS
echo 'select statistical_unit_refresh_now();' | ./devops/manage-statbus.sh psql
;;
'psql' )
# Only set postgres variables if they're not already set
if [ -z "${PGHOST:-}" ] || [ -z "${PGPORT:-}" ] || [ -z "${PGDATABASE:-}" ] || [ -z "${PGUSER:-}" ] || [ -z "${PGPASSWORD:-}" ]; then
eval $(./devops/manage-statbus.sh postgres-variables)
fi
eval $(./devops/manage-statbus.sh postgres-variables)
# The local psql is always tried first, as it has access to files
# used for copying in data.
if $(which psql > /dev/null); then
Expand Down

0 comments on commit 63c2bfe

Please sign in to comment.