Plans: - Plan limits and Pro prices per country live in the database (plan_configs, plan_prices, seeded with the previous constants) and are read through PlanCatalog (30 s cache, defaults as fallback). - /admin/plans edits limits (with the count of accounts that would become read-only) and prices, optionally pushing the new price to live subscriptions from their next charge (MP preapproval amount, Stripe item without proration) via the ApplyPriceChanges job, with an email and a notice on /billing. - GET /billing/plans feeds the onboarding and the billing screen. Mercado Pago: - The Pro checkout returns through GET /billing/return on API_PUBLIC_URL, since MP refuses a back_url on localhost. - The OAuth callback bounces from the tunnel to BETTER_AUTH_URL to find the session, requires the session to own the state, and redirects instead of answering JSON on unexpected errors. - Checkout Pro links skip auto_return off public HTTPS and carry a notification_url to POST /payments/webhooks/mp/:paymentId, which confirms the payment with the owner's token (same rule as the polling job, which stays as fallback). The search now prefers the approved attempt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95 lines
4.5 KiB
Plaintext
95 lines
4.5 KiB
Plaintext
# Variable template for `docker compose`.
|
|
#
|
|
# Local: copy this file to `.env` at the root and fill in the values.
|
|
# Dokploy: no file needed; define the same variables in the Environment tab of
|
|
# the Compose service (Dokploy writes them to a `.env` next to the compose
|
|
# file). The api container receives this whole file through `env_file`, so any
|
|
# variable the backend reads (docs/environment.md) works without touching the
|
|
# compose.
|
|
|
|
# Public origin of the app, no trailing slash. The same value feeds WEB_URL and
|
|
# BETTER_AUTH_URL because nginx proxies /api: the web and the API share a
|
|
# domain, so the session cookie is first-party.
|
|
WEB_URL="http://localhost:8080"
|
|
|
|
# Production PostgreSQL.
|
|
# The password must be percent-encoded: if it has #, @, :, /, ?, % or a space,
|
|
# escape it (%23, %40, %3A, %2F, %3F, %25, %20). Otherwise Prisma truncates the
|
|
# URL where the fragment starts and fails with P1013 "invalid port number in
|
|
# database URL".
|
|
DATABASE_URL="postgresql://user:password@localhost:5432/gruperly?schema=public"
|
|
|
|
# Generate it with: openssl rand -base64 32
|
|
BETTER_AUTH_SECRET=""
|
|
|
|
# ── Optional ─────────────────────────────────────────────────────────────────
|
|
|
|
# Social login with Google. Without a client id/secret the provider is not
|
|
# registered.
|
|
# GOOGLE_CLIENT_ID=""
|
|
# GOOGLE_CLIENT_SECRET=""
|
|
|
|
# Email sending (same variables as apps/backend/.env.example).
|
|
# EMAIL_PROVIDER="smtp"
|
|
# EMAIL_SERVER_HOST=""
|
|
# EMAIL_SERVER_PORT="587"
|
|
# EMAIL_SERVER_USER=""
|
|
# EMAIL_SERVER_PASSWORD=""
|
|
# EMAIL_FROM="Gruperly <no-reply@gruperly.com>"
|
|
|
|
# Mercado Pago (OAuth Authorization Code + PKCE). Opcionales: sin credenciales
|
|
# GET /mp/connect responde 503 mp_not_configured y la app sigue funcionando
|
|
# (el paso "Cobros" del onboarding es salteable).
|
|
# Generate it with: openssl rand -base64 32 -- exactly 32 bytes once decoded.
|
|
# TOKEN_ENCRYPTION_KEY=""
|
|
# Redirect URL registered in the Mercado Pago panel, character for character.
|
|
# The panel requires HTTPS (no http://localhost): local dev goes through a tunnel.
|
|
# MP_REDIRECT_URI="https://api.gruperly.com/api/v1/mp/callback"
|
|
# MP_CLIENT_ID=""
|
|
# MP_CLIENT_SECRET=""
|
|
|
|
# Suscripción a Gruperly Pro (ver docs/billing.md y docs/environment.md).
|
|
# Argentina la cobra con Suscripciones de Mercado Pago; el resto, con Stripe.
|
|
# Mercado Pago: credenciales de la cuenta de MP **de Gruperly** en Argentina. No
|
|
# son las del OAuth del profesor. Sin las dos, Pro queda "no disponible" (503).
|
|
# MP_PLATFORM_ACCESS_TOKEN_AR=""
|
|
# MP_PLATFORM_WEBHOOK_SECRET_AR=""
|
|
# Origen público de la API para la vuelta del checkout de Pro. Vacío =
|
|
# BETTER_AUTH_URL, que en este compose ya es el dominio público.
|
|
# API_PUBLIC_URL=""
|
|
# Stripe: una sola cuenta para BR, CL, CO, MX, PE y UY, cobrando en la moneda de
|
|
# cada país. Secret key (sk_live_…) y signing secret del webhook (whsec_…) del
|
|
# endpoint https://<API>/api/v1/billing/webhooks/stripe. Sin las dos, 503 ahí.
|
|
# STRIPE_SECRET_KEY=""
|
|
# STRIPE_WEBHOOK_SECRET=""
|
|
# on = aplica los límites del plan Free. Cualquier otro valor (o vacío): todos Pro.
|
|
# BILLING_ENFORCEMENT="off"
|
|
# Días que un Pro vencido (cancelado o con el cobro rechazado) sigue funcionando.
|
|
# BILLING_GRACE_DAYS="7"
|
|
|
|
# Backoffice (/admin): emails del equipo de Gruperly, separados por coma. Vacío = nadie.
|
|
# ADMIN_EMAILS=""
|
|
|
|
# WhatsApp: recordatorios de pago y reenganche semanales (docs/whatsapp.md).
|
|
# Opcional: sin las variables del proveedor elegido, /whatsapp/* responde 503
|
|
# whatsapp_not_configured y el paso del onboarding es salteable.
|
|
# WHATSAPP_PROVIDER="openwa" # openwa (MVP) | kapso
|
|
# WHATSAPP_SEND_INTERVAL_MS="5000" # pausa entre envios del mismo profesor
|
|
#
|
|
# OpenWA (se instala aparte, fuera de este compose).
|
|
# OPENWA_API_URL="https://openwa.example.com/api"
|
|
# OPENWA_API_KEY="" # key OPERATOR, sin allowedSessions
|
|
# OPENWA_WEBHOOK_URL="https://app.gruperly.com/api/v1/whatsapp/webhooks/openwa"
|
|
# OPENWA_WEBHOOK_SECRET="" # 16+ caracteres: openssl rand -hex 24
|
|
#
|
|
# Kapso (API oficial de WhatsApp Cloud).
|
|
# KAPSO_API_KEY=""
|
|
# KAPSO_CALLBACK_URL="https://app.gruperly.com/api/v1/whatsapp/callback"
|
|
# KAPSO_WEBHOOK_URL="https://app.gruperly.com/api/v1/whatsapp/webhooks/kapso"
|
|
# KAPSO_WEBHOOK_SECRET="" # el mismo del project webhook de Kapso
|
|
|
|
# Only if you want the API on another domain: it is baked into the Vite bundle
|
|
# and forces you to drop the /api proxy from apps/web/nginx.conf. Empty = same
|
|
# origin (recommended).
|
|
# VITE_API_URL=""
|