fix: Implementasi retry mechanism dan error handling untuk database connections Deskripsi: Menambahkan withRetry wrapper pada berbagai API routes untuk menangani transient database errors dan meningkatkan reliabilitas koneksi Memperbaiki error handling pada notification, authentication, dan user validation endpoints dengan response 503 untuk database connection errors Update prisma.ts dengan konfigurasi logging yang lebih baik dan datasources configuration Menambahkan validasi input parameters pada beberapa endpoints Update dokumentasi QWEN.md dengan commit message format dan comment standards Update .env.example dengan connection pool settings yang lebih lengkap File yang diubah: src/lib/prisma.ts — Konfigurasi Prisma client & logging src/app/api/admin/notifikasi/count/route.tsx src/app/api/auth/mobile-login/route.ts src/app/api/mobile/notification/[id]/route.ts src/app/api/user-validate/route.ts Dan 27 file API routes lainnya (penerapan withRetry secara konsisten) QWEN.md — Dokumentasi commit & comment standards .env.example — Database connection pool configuration ### No Issue
57 lines
1.9 KiB
Plaintext
57 lines
1.9 KiB
Plaintext
# ==============================
|
|
# Database
|
|
# ==============================
|
|
# Connection pool settings untuk mencegah connection exhaustion:
|
|
# - connection_limit=10: Maksimal 10 koneksi per Prisma Client instance
|
|
# - pool_timeout=20: Timeout menunggu koneksi tersedia (detik)
|
|
# - connect_timeout=10: Timeout untuk membuat koneksi baru (detik)
|
|
DATABASE_URL="postgresql://user:password@localhost:5432/dbname?connection_limit=10&pool_timeout=20&connect_timeout=10"
|
|
|
|
# ==============================
|
|
# Auth / Session
|
|
# ==============================
|
|
WIBU_PWD="your_wibu_password"
|
|
NEXT_PUBLIC_BASE_TOKEN_KEY="your_token_key"
|
|
NEXT_PUBLIC_BASE_SESSION_KEY="your_session_key"
|
|
|
|
# ==============================
|
|
# Payment Gateway (Midtrans)
|
|
# ==============================
|
|
Client_KEY="your_midtrans_client_key"
|
|
Server_KEY="your_midtrans_server_key"
|
|
|
|
# ==============================
|
|
# Maps
|
|
# ==============================
|
|
MAPBOX_TOKEN="your_mapbox_token"
|
|
|
|
# ==============================
|
|
# Realtime (WebSocket)
|
|
# ==============================
|
|
WS_APIKEY="your_ws_api_key"
|
|
NEXT_PUBLIC_WIBU_REALTIME_TOKEN="your_realtime_token"
|
|
|
|
# ==============================
|
|
# Email (Resend)
|
|
# ==============================
|
|
RESEND_APIKEY="your_resend_api_key"
|
|
|
|
# ==============================
|
|
# WhatsApp
|
|
# ==============================
|
|
WA_SERVER_TOKEN="your_wa_server_token"
|
|
|
|
# ==============================
|
|
# Firebase Admin (Push Notification)
|
|
# ==============================
|
|
FIREBASE_ADMIN_PROJECT_ID="your_firebase_project_id"
|
|
FIREBASE_ADMIN_CLIENT_EMAIL="your_firebase_client_email@project.iam.gserviceaccount.com"
|
|
# Private key: salin dari service account JSON, ganti newline dengan \n
|
|
FIREBASE_ADMIN_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n"
|
|
|
|
# ==============================
|
|
# App
|
|
# ==============================
|
|
NEXT_PUBLIC_API_URL="http://localhost:3000"
|
|
LOG_LEVEL="info"
|