File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 599599
600600echo "Detected PG major version: $PG_MAJOR"
601601
602+ # ANALYTICS_PASSWORD is generated by the operator (see replica.rs generate_password)
603+ # and stored in a Kubernetes secret - it is not user-controlled input, so
604+ # interpolating it directly into the SQL string is safe.
602605psql -U postgres -d postgres << SQLEOF
603- \getenv analytics_password ANALYTICS_PASSWORD
604606DO \$\$
605607BEGIN
606608 IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '${{ANALYTICS_USERNAME}}') THEN
607- CREATE ROLE ${{ANALYTICS_USERNAME}} WITH LOGIN;
609+ CREATE ROLE ${{ANALYTICS_USERNAME}} WITH LOGIN PASSWORD '${{ANALYTICS_PASSWORD}}';
610+ ELSE
611+ ALTER ROLE ${{ANALYTICS_USERNAME}} WITH PASSWORD '${{ANALYTICS_PASSWORD}}';
608612 END IF;
609613END
610614\$\$;
611- ALTER ROLE ${{ANALYTICS_USERNAME}} WITH PASSWORD :'analytics_password';
612615SQLEOF
613616
614617if [ "$PG_MAJOR" -ge 14 ] && [ "{read_only}" = "true" ]; then
You can’t perform that action at this time.
0 commit comments