TorbatYar/.env.example
Mortezakoohjani 047cd17afd fix(frontend): pass all BFF service URLs to frontend container
Wire CRM, loyalty, communication, and delivery service URLs into docker-compose
so Next.js API proxies reach Docker network hosts instead of localhost fallbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 13:28:50 +03:30

182 lines
8.6 KiB
Plaintext

# ============================================================
# SuperApp SaaS Platform - Environment Configuration Example
# این فایل را به .env کپی کنید و مقادیر واقعی را جایگزین نمایید.
# ============================================================
# ---- General ----
ENVIRONMENT=development # development | staging | production
DEBUG=true
LOG_LEVEL=INFO # DEBUG | INFO | WARNING | ERROR
SERVICE_NAME=core-service
API_V1_PREFIX=/api/v1
# ---- Platform Branding (White-label) ----
# برند نباید در کد hardcode شود؛ از این مقادیر استفاده کنید.
PLATFORM_NAME=Torbatyar
PLATFORM_SUPPORT_EMAIL=support@example.com
PLATFORM_PRIMARY_COLOR=#0284c7
PLATFORM_SECONDARY_COLOR=#0f172a
# دامنه پایه برای تخصیص خودکار زیردامنه tenant در onboarding (مثلاً <slug>.torbatyar.xyz)
# دامنه پایه برای تخصیص خودکار زیردامنه tenant (مثلاً <slug>.torbatyar.ir)
PLATFORM_BASE_DOMAIN=torbatyar.ir
# ---- Auto SSL for tenant domains (Celery → SSH → nginx certbot) ----
SSL_PROVISION_ENABLED=false
SSL_PROVISION_HOST=192.168.10.156
SSL_PROVISION_USER=torbatyaruser
SSL_PROVISION_PASSWORD=
SSL_PROVISION_SCRIPT=/opt/torbatyar/bin/provision_ssl.py
# ---- Core Database (core_platform_db) ----
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=superapp
POSTGRES_PASSWORD=superapp_password
POSTGRES_DB=core_platform_db
# async driver برای FastAPI/SQLAlchemy
DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/core_platform_db
# sync driver برای Alembic
DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/core_platform_db
# ---- Redis ----
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
REDIS_URL=redis://redis:6379/0
FEATURE_ACCESS_CACHE_TTL=300 # ثانیه
TENANT_METADATA_CACHE_TTL=300
# ---- Celery ----
CELERY_BROKER_URL=redis://redis:6379/1
CELERY_RESULT_BACKEND=redis://redis:6379/2
# ---- Keycloak / SSO (فاز ۲ — فعال در Docker) ----
# Production: auth.torbatyar.ir پشت nginx روی 192.168.10.156
# Dev محلی: می‌توانید hosts را به 127.0.0.1 اشاره دهید.
KEYCLOAK_ENABLED=true
KEYCLOAK_SERVER_URL=http://keycloak:8080
KEYCLOAK_PUBLIC_URL=https://auth.torbatyar.ir
KEYCLOAK_HOSTNAME=auth.torbatyar.ir
KEYCLOAK_HOSTNAME_STRICT_HTTPS=false
KEYCLOAK_REALM=superapp
KEYCLOAK_CLIENT_ID=core-service
KEYCLOAK_CLIENT_SECRET=change-me
JWT_ALGORITHM=RS256
JWT_AUDIENCE=account
JWT_VERIFY_SIGNATURE=true
# در production و Docker باید true باشد؛ در تست‌ها false
AUTH_REQUIRED=true
# ---- Identity & Access Service ----
IDENTITY_SERVICE_URL=http://identity-access-service:8001
IDENTITY_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/identity_access_db
IDENTITY_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/identity_access_db
KEYCLOAK_FRONTEND_CLIENT_ID=superapp-frontend
KEYCLOAK_IDENTITY_CLIENT_SECRET=change-me-identity
IDENTITY_KEYCLOAK_CLIENT_ID=identity-access-service
FRONTEND_CALLBACK_URL=https://torbatyar.ir/auth/callback
CORS_ORIGINS=https://torbatyar.ir,https://www.torbatyar.ir,http://torbatyar.ir,http://www.torbatyar.ir,http://localhost:3000
CORE_SERVICE_URL=http://core-service:8000
# ---- Accounting Service ----
ACCOUNTING_SERVICE_URL=http://accounting-service:8002
ACCOUNTING_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/accounting_db
ACCOUNTING_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/accounting_db
ACCOUNTING_SERVICE_NAME=accounting-service
# ---- CRM Service ----
CRM_SERVICE_URL=http://crm-service:8003
CRM_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/crm_db
CRM_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/crm_db
CRM_SERVICE_NAME=crm-service
# ---- Loyalty Service ----
LOYALTY_SERVICE_URL=http://loyalty-service:8004
LOYALTY_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/loyalty_db
LOYALTY_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/loyalty_db
LOYALTY_SERVICE_NAME=loyalty-service
# ---- Communication Service (Phase 8) ----
COMMUNICATION_SERVICE_URL=http://communication-service:8005
COMMUNICATION_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/communication_db
COMMUNICATION_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/communication_db
COMMUNICATION_SERVICE_NAME=communication-service
# ---- Sports Center Service (Phase 9.0) ----
SPORTS_CENTER_SERVICE_URL=http://sports-center-service:8006
SPORTS_CENTER_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/sports_center_db
SPORTS_CENTER_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/sports_center_db
SPORTS_CENTER_SERVICE_NAME=sports-center-service
# ---- Delivery Service (Phase 10.0 / Torbat Driver) ----
DELIVERY_SERVICE_URL=http://delivery-service:8007
DELIVERY_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/delivery_db
DELIVERY_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/delivery_db
DELIVERY_SERVICE_NAME=delivery-service
# ---- Healthcare Service (Phase 13.0) ----
HEALTHCARE_SERVICE_URL=http://healthcare-service:8010
HEALTHCARE_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/healthcare_db
HEALTHCARE_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/healthcare_db
HEALTHCARE_SERVICE_NAME=healthcare-service
# ---- Beauty Business Service (Phase 14.0 / Torbat Beauty) ----
BEAUTY_BUSINESS_SERVICE_URL=http://beauty-business-service:8011
BEAUTY_BUSINESS_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/beauty_business_db
BEAUTY_BUSINESS_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/beauty_business_db
BEAUTY_BUSINESS_SERVICE_NAME=beauty-business-service
# ---- Hospitality Service (Phase 12.0 / Torbat Food) ----
HOSPITALITY_SERVICE_URL=http://hospitality-service:8009
HOSPITALITY_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/hospitality_db
HOSPITALITY_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/hospitality_db
HOSPITALITY_SERVICE_NAME=hospitality-service
EXPERIENCE_SERVICE_URL=http://experience-service:8008
EXPERIENCE_DATABASE_URL=postgresql+asyncpg://superapp:superapp_password@postgres:5432/experience_db
EXPERIENCE_DATABASE_URL_SYNC=postgresql+psycopg://superapp:superapp_password@postgres:5432/experience_db
EXPERIENCE_SERVICE_NAME=experience-service
# ---- OTP / Payamak SMS (Core Service) ----
# ApiKey را در پارامتر password ارسال کنید (طبق مستندات ملی‌پیامک)
PAYAMAK_USERNAME=9155105404
PAYAMAK_FROM=9982004961
PAYAMAK_FROM_NUMBER=9982004961
# ApiKey را در پارامتر password ارسال کنید (مستندات ملی‌پیامک)
PAYAMAK_API_KEY=967ceb37-eeef-429c-b6c5-b60a15306e4f
PAYAMAK_APIKEY=967ceb37-eeef-429c-b6c5-b60a15306e4f
PAYAMAK_PASSWORD=967ceb37-eeef-429c-b6c5-b60a15306e4f
PAYAMAK_BODY_ID=245189
# آدرس رسمی: https://api.payamak-panel.com/post/send.asmx/SendByBaseNumber
JWT_SECRET=change-me-jwt-secret
OTP_EXPIRE_SECONDS=120
# شماره‌های ادمین پلتفرم (OTP) — با کاما جدا شوند
PLATFORM_ADMIN_MOBILES=09155105404
# ---- Frontend (Next.js) ----
FRONTEND_PORT=3000
NEXT_PUBLIC_PLATFORM_BASE_DOMAIN=torbatyar.ir
NEXT_PUBLIC_BACKEND_URL=https://api.torbatyar.ir
NEXT_PUBLIC_API_BASE_URL=https://api.torbatyar.ir
NEXT_PUBLIC_IDENTITY_API_URL=https://identity.torbatyar.ir
NEXT_PUBLIC_KEYCLOAK_URL=https://auth.torbatyar.ir
NEXT_PUBLIC_KEYCLOAK_REALM=superapp
NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=superapp-frontend
NEXT_PUBLIC_ACCOUNTING_API_URL=http://localhost:8002
NEXT_PUBLIC_CRM_API_URL=http://localhost:8003
NEXT_PUBLIC_LOYALTY_API_URL=http://localhost:8004
NEXT_PUBLIC_COMMUNICATION_API_URL=http://localhost:8005
NEXT_PUBLIC_SPORTS_CENTER_API_URL=http://localhost:8006
NEXT_PUBLIC_DELIVERY_API_URL=http://localhost:8007
NEXT_PUBLIC_EXPERIENCE_API_URL=http://localhost:8008
NEXT_PUBLIC_HOSPITALITY_API_URL=http://localhost:8009
NEXT_PUBLIC_HEALTHCARE_API_URL=http://localhost:8010
NEXT_PUBLIC_BEAUTY_BUSINESS_API_URL=http://localhost:8011
INTERNAL_TOKEN_SECRET=change-me-internal-secret
# ---- Keycloak Bootstrap ----
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin