Files
postgres/init/02-set-passwords.sh
2026-02-01 14:43:27 -05:00

14 lines
458 B
Bash
Executable File

#!/bin/bash
set -e
# Set password for news_1440 user from secrets file
if [ -f /run/secrets/news_1440_password ]; then
NEWS_1440_PASS=$(cat /run/secrets/news_1440_password)
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname postgres <<-EOSQL
ALTER USER news_1440 WITH PASSWORD '$NEWS_1440_PASS';
EOSQL
echo "Password set for news_1440 user"
else
echo "Warning: news_1440_password secret not found, user has no password"
fi