fix(ente): use TCP connection for psql in ente-setup

Peer authentication fails when running as root but connecting as
user 'ente'. Use PGPASSWORD with -h 127.0.0.1 to force TCP/password
authentication instead of Unix socket peer auth.
This commit is contained in:
CanbiZ (MickLesk)
2026-03-27 16:00:30 +01:00
parent 4eb9090ce5
commit f3b9feba2a

View File

@@ -356,8 +356,8 @@ if [ -z "$EMAIL" ]; then
fi
DB_NAME="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')"
DB_USER="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/user:/{print $2}')"
USER_ID=$(psql -U "$DB_USER" -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;")
DB_PASS="$(grep -A5 '^db:' /opt/ente/server/museum.yaml | awk '/password:/{print $2}')"
USER_ID=$(PGPASSWORD="$DB_PASS" psql -h 127.0.0.1 -U ente -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;")
if [ -z "$USER_ID" ]; then
echo "Error: No user found with email $EMAIL"
echo "Make sure you created and verified the account via the web UI first."