mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 14:19:11 +03:00
fix: sync supabase roles with $POSTGRES_PASSWORD
This commit is contained in:
2 files changed
+7
-11
No files matched your search
@@ -386,7 +386,7 @@ services:
|
||||
# Comment out everything below this point if you are using an external Postgres database
|
||||
db:
|
||||
container_name: supabase-db
|
||||
image: supabase/postgres:15.8.1.060
|
||||
image: supabase/postgres:15-local
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./volumes/db/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z
|
||||
@@ -434,7 +434,6 @@ services:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
JWT_EXP: ${JWT_EXPIRY}
|
||||
entrypoint: ["/usr/local/bin/entrypoint.sh"]
|
||||
command:
|
||||
[
|
||||
"postgres",
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeo pipefail
|
||||
|
||||
# Source the Docker entrypoint script
|
||||
source /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
sync_password() {
|
||||
# Start a temporary server to run the roles SQL file
|
||||
# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
|
||||
# e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS
|
||||
export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}"
|
||||
docker_temp_server_start "$@"
|
||||
|
||||
# First alter the supabase_admin password as postgres superuser
|
||||
echo "Setting supabase_admin password..."
|
||||
psql -U supabase_admin -d postgres <<-'EOSQL'
|
||||
# alter the supabase_admin password
|
||||
docker_process_sql <<-'EOSQL'
|
||||
\set pgpass `echo "$POSTGRES_PASSWORD"`
|
||||
ALTER USER supabase_admin WITH PASSWORD :'pgpass';
|
||||
EOSQL
|
||||
|
||||
# Now execute the roles SQL file using docker_process_sql as supabase_admin
|
||||
echo "Updating roles..."
|
||||
# execute the roles SQL file using docker_process_sql
|
||||
docker_process_sql -f /docker-entrypoint-initdb.d/init-scripts/99-roles.sql
|
||||
|
||||
# Stop the temporary server
|
||||
docker_temp_server_stop
|
||||
unset PGPASSWORD
|
||||
}
|
||||
@@ -74,7 +71,7 @@ _main() {
|
||||
EOM
|
||||
fi
|
||||
|
||||
# sync_password "$@"
|
||||
sync_password "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
Reference in new issue
Block a user