Skip to content

Commit

Permalink
chore: update cors settings
Browse files Browse the repository at this point in the history
  • Loading branch information
k61b committed Aug 11, 2023
1 parent c793d57 commit 46ee92d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/src/core/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as dotenv from 'dotenv';
dotenv.config();

export interface Config {
clientUrl: string;
origin: string;
port: number;
version: string;
Expand Down Expand Up @@ -33,12 +34,12 @@ export interface Config {
password: string;
};
database: string;
clientUrl: string;
reportTokenSecret: string;
}

export const config = {
port: parseInt(process.env.PORT, 10) || 3000,
clientUrl: process.env.CLIENT_URL,
origin: process.env.ORIGIN,
version: process.env.VERSION,
reportTokenSecret: process.env.REPORT_TOKEN_SECRET,
Expand Down Expand Up @@ -70,7 +71,6 @@ export const config = {
password: process.env.CB_PASSWORD,
},
database: process.env.DATABASE,
clientUrl: process.env.CLIENT_URL,
};

export default config as Config;
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const useMorgan = (app: NestExpressApplication) => {

const enableCors = (app: NestExpressApplication) => {
app.enableCors({
origin: config.origin,
origin: [config.clientUrl, config.origin],
methods: 'GET, HEAD, PUT, PATCH, POST, DELETE, OPTIONS',
credentials: true,
});
Expand Down

0 comments on commit 46ee92d

Please sign in to comment.