Correos: leer la URL publica en tiempo de ejecucion (APP_URL)
Next incrusta process.env.NEXT_PUBLIC_* en el bundle al compilar, tambien en codigo de servidor y aun con clave calculada. La imagen de produccion se construye sin NEXT_PUBLIC_APP_URL, asi que los links de los correos de cobro quedaban fijos en http://localhost:3000. Ahora se lee APP_URL (variable de servidor) al enviar. Compose de Coolify, .env.example y AGENTS.md actualizados. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5e2b784c24
commit
14526f92f2
@@ -90,7 +90,7 @@ A quoted line item is `fijo` (default), `horas`, `retainer`, or `demanda` — se
|
||||
|
||||
- Production stack: postgres + web + api. The live Coolify app (`cotizador`, uuid `e6vie34d83iv5vw3eyzinl3s`, https://cotizador.urieljareth.org) has **Docker Compose Location `/docker-compose.yaml`** — the byte-identical copy — so both files must stay in sync. Local dev keeps using `docker-compose.yml` + `start.bat`.
|
||||
- **Deploys come from GitHub `main` (`origin`), not Gitea.** Auto-deploy is on: a push to GitHub `main` *is* the deploy (~15 min full build). Pushing to `gitea` only mirrors the code. Don't also trigger the deploy API after a push, or two deploys race.
|
||||
- `NEXT_PUBLIC_APP_URL` must be set in Coolify: email and push links fall back to `http://localhost:3000` without it.
|
||||
- `APP_URL` must be set in Coolify (`https://cotizador.urieljareth.org`): email links fall back to `http://localhost:3000` without it. **Never read a runtime value through a `NEXT_PUBLIC_*` name on the server** — Next inlines those at build time (even via a computed key), and the production image is built without them.
|
||||
- The `web` container runs `prisma migrate deploy` on every start, and the seed only when `RUN_SEED=true`. Seed users/passwords come from `SEED_*` env vars (see `.env.example`) — `prisma/seed.ts` never overwrites an existing password unless the env var is set.
|
||||
- `DATABASE_URL` is only used by the Prisma CLI (migrations); the apps use individual `DB_*` vars. Both must point to the same DB.
|
||||
- Healthchecks: web `GET /api/health` (public in middleware, pings DB), api `GET /health`.
|
||||
|
||||
Reference in New Issue
Block a user