Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ DATABASE_URL=postgresql://postgres:postgres@db:5432/Qtrive

FRONTEND_URL=http://localhost:5173

# Comma-separated origins the browser may call the API from.
# Optional, this is the default.
CORS_ORIGIN=http://localhost:5173

```

*When running `/apps/ws-server` outside Docker*, copy `.env.example` and put
Expand Down
9 changes: 8 additions & 1 deletion apps/http-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ import { requestLogger } from './middlewares/requestLogger'

const app: Express = express()

// Comma-separated list, same as apps/streaming. Production sets this to the
// real site in .env.prod.
const corsOrigins = (process.env.CORS_ORIGIN || 'http://localhost:5173')
.split(',')
.map((origin) => origin.trim())
.filter(Boolean)

app.use(cors({
origin: 'https://rexial.in',
origin: corsOrigins,
credentials: true
}))
app.use(requestLogger)
Expand Down
4 changes: 4 additions & 0 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ DATABASE_URL=postgresql://postgres:postgres@db:5432/Qtrive

FRONTEND_URL=http://localhost:5173

# Comma-separated origins the browser may call the API from.
# Optional, this is the default.
CORS_ORIGIN=http://localhost:5173

```

If you run the WebSocket server outside Docker, copy its example environment
Expand Down
Loading