Skip to content

Commit

Permalink
feat: making origin an array
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLzq committed Sep 8, 2024
1 parent 77b1087 commit dcea0ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/network/socket/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Server } from 'socket.io'
import * as routes from './routes'

const PORT = parseInt(process.env.PORT as string) || 1996
const ORIGIN = ['http://localhost:3000'].concat(
process.env.FRONT_URLS?.split(',') ?? []
)

const socketConnection = (d: Debugger) => ({
connect: () => {
Expand Down Expand Up @@ -33,7 +36,7 @@ const socketConnection = (d: Debugger) => ({
fn(null, true)
},
cors: {
origin: ['http://localhost:3000', process.env.FRONT_URL as string]
origin: ORIGIN
}
})

Expand Down

0 comments on commit dcea0ee

Please sign in to comment.