Skip to main content
Glama
yty-build
by yty-build
refresh_password.sh1.25 kB
#!/bin/bash # Refresh PgBouncer password from AWS Secrets Manager # This script should be run periodically (e.g., via cron) or triggered on auth failure set -e echo "Refreshing PgBouncer password from AWS Secrets Manager..." # Fetch latest password from AWS (requires aws-cli in container) if command -v aws &> /dev/null; then # Fetch the password secret PASSWORD=$(aws secretsmanager get-secret-value \ --secret-id "${AWS_PASSWORD_SECRET_NAME}" \ --region "${AWS_REGION:-us-west-2}" \ --query 'SecretString' \ --output text | jq -r '.password') if [ -n "$PASSWORD" ] && [ "$PASSWORD" != "null" ]; then # Update userlist.txt echo "\"$POSTGRES_USER\" \"$PASSWORD\"" > /etc/pgbouncer/userlist.txt chmod 600 /etc/pgbouncer/userlist.txt # Reload PgBouncer configuration (SIGHUP) pgbouncer -R /etc/pgbouncer/pgbouncer.ini || \ killall -HUP pgbouncer || \ echo "Could not reload PgBouncer - manual restart may be required" echo "✅ PgBouncer password refreshed successfully" else echo "❌ Failed to fetch password from AWS Secrets" exit 1 fi else echo "❌ aws-cli not installed in container" exit 1 fi

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yty-build/postgres_mcp_allaccess'

If you have feedback or need assistance with the MCP directory API, please join our Discord server