Skip to content

Commit

Permalink
chore: enable cors
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhhTien committed May 26, 2024
1 parent 912b7f8 commit 85772a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

#FURNIQUE
CORS_VALID_ORIGINS=localhost,ngrok-free
CORS_VALID_ORIGINS=localhost,ngrok-free,furnique.tech
WEB_URL=https://www.furnique.tech
SERVER_URL=https://api.furnique.tech

Expand Down
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule)

// Sentry
if (process.env.NODE_ENV === 'development') { //'production'
if (process.env.NODE_ENV === 'production') {
sentryInit({
dsn: process.env.SENTRY_DSN,
integrations: [
Expand All @@ -35,9 +35,9 @@ async function bootstrap() {
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0
})
app.use(SentryHandlers.requestHandler())
app.use(SentryHandlers.tracingHandler())
}
app.use(SentryHandlers.requestHandler())
app.use(SentryHandlers.tracingHandler())

const logger = app.get(AppLogger)
const discordService = app.get(DiscordService)
Expand Down Expand Up @@ -81,10 +81,10 @@ async function bootstrap() {
// Example: process.env.CORS_VALID_ORIGINS=localhost,ngrok-free => parse to [ /localhost/, /ngrok-free/ ]
const origins = process.env.CORS_VALID_ORIGINS?.split(',').map((origin) => new RegExp(origin)) || [
/localhost/,
/ngrok-free/
/ngrok-free/,
/furnique.tech/
]
// app.enableCors({ origin: origins }); // use later
app.enableCors()
app.enableCors({ origin: origins });

const port = process.env.PORT || 5000
await app.listen(port)
Expand Down

0 comments on commit 85772a2

Please sign in to comment.