cambios en postgress, no me esta gustando el problema de autenticacion
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m6s
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m6s
This commit is contained in:
@@ -3,6 +3,10 @@ set -e
|
||||
|
||||
echo "Configurando autenticación de PostgreSQL..."
|
||||
|
||||
POSTGRES_USER="${POSTGRES_USER:-seguidor}"
|
||||
POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-seguidor_password}"
|
||||
POSTGRES_DB="${POSTGRES_DB:-$POSTGRES_USER}"
|
||||
|
||||
# Eliminar configuración scram-sha-256 y agregar md5
|
||||
# Esto asegura que las conexiones remotas funcionen correctamente
|
||||
sed -i '/scram-sha-256/d' "$PGDATA/pg_hba.conf"
|
||||
@@ -12,7 +16,16 @@ if ! grep -q "host all all all md5" "$PGDATA/pg_hba.conf"; then
|
||||
echo "host all all all md5" >> "$PGDATA/pg_hba.conf"
|
||||
fi
|
||||
|
||||
echo "✓ Configuración de autenticación aplicada (md5)"
|
||||
# Forzar que las contraseñas se guarden en md5 (no scram) y
|
||||
# reescribir la contraseña para asegurar que coincide con las env vars.
|
||||
ESCAPED_PASSWORD=${POSTGRES_PASSWORD//\'/\'\'}
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
ALTER SYSTEM SET password_encryption = 'md5';
|
||||
ALTER ROLE "$POSTGRES_USER" WITH PASSWORD '${ESCAPED_PASSWORD}';
|
||||
SELECT pg_reload_conf();
|
||||
EOSQL
|
||||
|
||||
echo "✓ Configuración de autenticación aplicada (md5 + password sincronizada)"
|
||||
|
||||
# Nota: No es necesario recargar aquí porque este script corre ANTES
|
||||
# de que PostgreSQL termine su inicialización. Los cambios se aplican
|
||||
|
||||
Reference in New Issue
Block a user