bugs fixed
Some checks failed
check / markdownlint (push) Has been cancelled
check / spellchecker (push) Has been cancelled

This commit is contained in:
Yajbir Singh
2025-12-11 17:26:52 +05:30
parent a5644ce9fb
commit 38c1f31a09

View File

@@ -267,12 +267,24 @@ if [ "${DB_HOST}" = "localhost" ]; then
fi fi
# Force trust authentication for localhost connections # Force trust authentication for localhost connections
# This fixes the "password authentication failed" error # Check standard Ubuntu location first, then data directory
if [ -d "${PGDATA}" ]; then PG_CONF_FILE="/etc/postgresql/${PG_VERSION:-16}/main/pg_hba.conf"
echo "local all onlyoffice trust" > "${PGDATA}/pg_hba.conf" if [ ! -f "$PG_CONF_FILE" ]; then
echo "local all all peer" >> "${PGDATA}/pg_hba.conf" PG_CONF_FILE="${PGDATA}/pg_hba.conf"
echo "host all all 127.0.0.1/32 trust" >> "${PGDATA}/pg_hba.conf" fi
echo "host all all ::1/128 trust" >> "${PGDATA}/pg_hba.conf"
if [ -f "$PG_CONF_FILE" ]; then
echo "Found pg_hba.conf at: $PG_CONF_FILE"
# Backup original
cp "$PG_CONF_FILE" "${PG_CONF_FILE}.bak"
# Overwrite with trust settings
echo "local all onlyoffice trust" > "$PG_CONF_FILE"
echo "local all all peer" >> "$PG_CONF_FILE"
echo "host all all 127.0.0.1/32 trust" >> "$PG_CONF_FILE"
echo "host all all ::1/128 trust" >> "$PG_CONF_FILE"
chown postgres:postgres "$PG_CONF_FILE"
else
echo "WARNING: pg_hba.conf not found!"
fi fi
LOCAL_SERVICES+=("postgresql") LOCAL_SERVICES+=("postgresql")