diff --git a/supabase/postgres/supervisord.conf b/supabase/postgres/supervisord.conf index 16cb18d..062676f 100644 --- a/supabase/postgres/supervisord.conf +++ b/supabase/postgres/supervisord.conf @@ -21,7 +21,8 @@ user=root autorestart=true stdout_logfile=/var/log/postgres.out.log stderr_logfile=/var/log/postgres.err.log -environment=POSTGRES_PASSWORD="postgres" +environment=POSTGRES_PASSWORD="postgres",POSTGRES_USER="supabase_admin",POSTGRES_DB="postgres",PGDATA="/var/lib/postgresql/data" + [program:postgrest] diff --git a/supabase/postgres/wrapper.sh b/supabase/postgres/wrapper.sh index 1c6d72f..0a3d1e2 100644 --- a/supabase/postgres/wrapper.sh +++ b/supabase/postgres/wrapper.sh @@ -1,4 +1,10 @@ #!/bin/bash set -e -exec /usr/local/bin/docker-entrypoint.sh postgres -D /etc/postgresql \ No newline at end of file +# 设置 PostgreSQL 初始化关键变量(如果没从环境变量中设定) +export POSTGRES_USER="${POSTGRES_USER:=supabase_admin}" +export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:=postgres}" +export POSTGRES_DB="${POSTGRES_DB:=postgres}" +export PGDATA="${PGDATA:=/var/lib/postgresql/data}" + +exec /usr/local/bin/docker-entrypoint.sh postgres -D "$PGDATA" \ No newline at end of file