Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

# --- App ---------------------------------------------------------------
NODE_ENV=development
PORT=3000
PORT=3001
# Public URL of this API, used to build OAuth callback / webhook URLs
APP_URL=http://localhost:3000
APP_URL=http://localhost:3001
# Frontend URL, used for CORS + OAuth redirect back to the SPA
FRONTEND_URL=http://localhost:3001
FRONTEND_URL=http://localhost:3000

# --- Database (PostgreSQL via TypeORM) ----------------------------------
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mergefi
Expand Down
13 changes: 10 additions & 3 deletions src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,16 @@ export interface AppConfig {

export default (): AppConfig => ({
env: process.env.NODE_ENV ?? 'development',
port: parseInt(process.env.PORT ?? '3000', 10),
appUrl: process.env.APP_URL ?? 'http://localhost:3000',
frontendUrl: process.env.FRONTEND_URL ?? 'http://localhost:3001',
// The frontend's `next dev` occupies 3000 — the backend's default is 3001
// so a fresh dev setup doesn't port-collide (#590).
port: parseInt(process.env.PORT ?? '3001', 10),
// FRONTEND_URL is the CORS origin + OAuth redirect target — it must match
// where the frontend actually serves. `next dev` runs on 3000, so the old
// 3001 default made CORS reject the frontend's origin and OAuth redirect
// wrong (#590). And the backend's own default PORT must differ from the
// frontend's 3000 — moved to 3001 so dev defaults don't collide.
appUrl: process.env.APP_URL ?? 'http://localhost:3001',
frontendUrl: process.env.FRONTEND_URL ?? 'http://localhost:3000',
logLevel: process.env.LOG_LEVEL ?? 'debug',
database: {
url:
Expand Down