TorbatYar/.env.example
Mortezakoohjani 064d67f099 Ship CRM Core Platform (phases 6.0–6.3) with docs and prod deploy.
Add the Sales CRM service through collaboration, sync architecture/registry docs, expose crm.torbatyar.ir, and include a production deploy script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 20:32:00 +03:30

126 lines
5.2 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
# ---- 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
INTERNAL_TOKEN_SECRET=change-me-internal-secret
# ---- Keycloak Bootstrap ----
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin