Commit Graph

4 Commits

Author SHA1 Message Date
Tengku Achmad ed431947c1 fix: correct frontend serve port to match nginx proxy target (4173)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 00:30:18 +07:00
Tengku Achmad 975f26be59 fix: align ecosystem.config.cjs with actual production pm2 process names
The file previously defined dev-backend-midtrans/dev-frontend-midtrans, but
the real production processes are named backend-midtrans-prod and
frontend-midtrans-prod (confirmed via pm2 ls on the server) and were started
with different serve invocation flags (interpreter: none, -s dist -p 3000
instead of interpreter: serve, -p 3001). This file was previously out of
sync with reality, so NODE_ENV=production set here never actually reached
the running backend process.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 00:18:19 +07:00
Tengku Achmad 441e6261a2 fix: harden payment-creation endpoints and persist server state
- ecosystem.config.cjs: NODE_ENV was hardcoded to "development" even for the
  production pm2 process, silently disabling every isDevEnv()-gated security
  check (API key bypass, admin auth bypass) in production. Now "production".
- Restrict CORS via configurable CORS_ALLOWED_ORIGINS (falls back to allow-all
  with a warning when unset, so this doesn't break existing traffic on deploy).
- Add an in-process, dependency-free rate limiter on /createtransaksi,
  /api/payment-links, /api/payments/charge, and /api/payments/snap/token to
  curb bot abuse / card-testing on endpoints the browser checkout must be able
  to call directly (an API-key gate would break that legitimate flow).
- Auto-delete LOGS_*.log files older than LOG_RETENTION_DAYS (default 30).
- Persist activeOrders, notifiedOrders, orderRetryCount, and orderMerchantId to
  server/data/state.json via Proxy-wrapped Map/Set (schedulePersist on every
  mutation), so idempotency and retry-suffix tracking survive restarts/crashes
  instead of resetting to empty every deploy.
- Remove processPaymentCompletion, dead code with no call sites.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-03 22:48:37 +07:00
Ariq 34ee97848d adding ecosystem 2025-11-28 07:24:50 +00:00