Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
feat: add configurable cors origin via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCharrier committed Oct 31, 2023
1 parent a8c2ad1 commit 60d9079
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export default {
CHATWOOT_ID: process.env.CHATWOOT_ID,
CHATWOOT_IGNORE_EMAILS: process.env.CHATWOOT_IGNORE_EMAILS || [],
CHATWOOT_BADGE_ID: process.env.CHATWOOT_BADGE_ID,
CORS_ORIGIN: process.env.CORS_ORIGIN
? process.env.CORS_ORIGIN.split(',')
: ['https://espace-membre.incubateur.net'],
domain: process.env.SECRETARIAT_DOMAIN || 'beta.gouv.fr',
DS_TOKEN: process.env.DS_TOKEN,
DS_DEMARCHE_NUMBER: process.env.DS_DEMARCHE_NUMBER
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {
} from './controllers/startupController/getStartupInfoCreate';
export const app = express();
const corsOptions = {
origin: ['http://localhost:8100', 'http://localhost:3001'],
origin: config.CORS_ORIGIN,
credentials: true,
methods: 'POST, PUT, OPTIONS, DELETE, GET',
allowedHeaders: 'X-Requested-With, Content-Type',
Expand Down

0 comments on commit 60d9079

Please sign in to comment.