#==============================================================#
# File      :   .env
# Desc      :   supabase docker configuration entries
# Ctime     :   2023-09-19
# Mtime     :   2025-07-01
# Path      :   app/supabase/.env
# License   :   Apache-2.0 @ https://pigsty.io/docs/about/license/
# Copyright :   2018-2026  Ruohang Feng / Vonng (rh@vonng.com)
#==============================================================#
# https://github.com/supabase/supabase/blob/master/docker/.env.example

############
# Secrets
# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
############
# IMPORTANT: https://supabase.com/docs/guides/self-hosting/docker#securing-your-services

POSTGRES_PASSWORD=DBUser.Supa       # supabase dbsu password (shared by multiple supabase biz users)
JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
ANON_KEY=your-anon-key-here
SERVICE_ROLE_KEY=your-service-role-key-here
SECRET_KEY_BASE=your-secret-key-base
PG_META_CRYPTO_KEY=your-encryption-key-32-chars-min

DASHBOARD_USERNAME=supabase         # change to your own username
DASHBOARD_PASSWORD=pigsty           # change to your own password


############
# Database - You can change these to any PostgreSQL database that has logical replication enabled.
############
POSTGRES_HOST=10.10.10.10           # change to Pigsty managed PostgreSQL cluster/instance VIP/IP
POSTGRES_PORT=5432                  # you can use other service port such as 5433, 5436, 6432, etc...
POSTGRES_DB=postgres                # change to supabase database name, `supa` by default in pigsty
POSTGRES_DOMAIN=pg-meta             # in case you want to use domain name in database URL

############
# Domain
# YOU MUST CHANGE THESE WHEN ACCESS VIA DOMAIN NAME
############
# replace if you intend to use Studio outside of localhost
SUPABASE_PUBLIC_URL=http://supa.pigsty
API_EXTERNAL_URL=http://supa.pigsty
SITE_URL=http://supa.pigsty


############
# API Proxy - Configuration for the Kong Reverse proxy.
############
KONG_HTTP_PORT=8000
KONG_HTTPS_PORT=8443


############
# API - Configuration for PostgREST.
############
PGRST_DB_SCHEMAS=public,storage,graphql_public


############
# Auth - Configuration for the GoTrue authentication server.
############

## General
ADDITIONAL_REDIRECT_URLS=
JWT_EXPIRY=3600
DISABLE_SIGNUP=false

## Mailer Config
MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"
MAILER_URLPATHS_INVITE="/auth/v1/verify"
MAILER_URLPATHS_RECOVERY="/auth/v1/verify"
MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"

## Email auth
ENABLE_EMAIL_SIGNUP=true
ENABLE_EMAIL_AUTOCONFIRM=true

SMTP_ADMIN_EMAIL=admin@example.com
SMTP_HOST=supabase-mail
SMTP_PORT=2500
SMTP_USER=fake_mail_user
SMTP_PASS=fake_mail_password
SMTP_SENDER_NAME=fake_sender
ENABLE_ANONYMOUS_USERS=false

## Phone auth
ENABLE_PHONE_SIGNUP=true
ENABLE_PHONE_AUTOCONFIRM=true


############
# Studio - Configuration for the Dashboard
############

STUDIO_PORT=3000
STUDIO_DEFAULT_PROJECT=Pigsty
STUDIO_DEFAULT_ORGANIZATION=Pigsty

# Enable webp support
IMGPROXY_ENABLE_WEBP_DETECTION=true

# Add your OpenAI API key to enable SQL Editor Assistant
OPENAI_API_KEY=

############
# Storage - Use external s3 or minio
############
S3_BUCKET=supa
S3_ENDPOINT=https://sss.pigsty:9000
S3_ACCESS_KEY=supabase
S3_SECRET_KEY=S3User.Supabase
S3_FORCE_PATH_STYLE=true
S3_PROTOCOL=https
S3_REGION=stub
MINIO_DOMAIN_IP=10.10.10.10

############
# Realtime - Configuration for Realtime
############
SECRET_KEY_BASE=your-secret-key-base

############
# Functions - Configuration for Functions
############
# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.
FUNCTIONS_VERIFY_JWT=false

############
# Logs - Configuration for Analytics
# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction
############

# use 32~64 character long random string for each key, the keys must be different
LOGFLARE_PUBLIC_ACCESS_TOKEN=your-logflare-public-token-here
LOGFLARE_PRIVATE_ACCESS_TOKEN=your-logflare-private-token-here
LOGFLARE_LOG_LEVEL=error

# Docker socket location - this value will differ depending on your OS
DOCKER_SOCKET_LOCATION=/var/run/docker.sock
