Skip to content
Snippets Groups Projects
Unverified Commit fa9ea559 authored by Florian Raith's avatar Florian Raith Committed by GitHub
Browse files

Enable cors only for development (#8)

parent 08201b77
No related branches found
No related tags found
No related merge requests found
......@@ -10,12 +10,14 @@ import { MikroORM, UseRequestContext } from '@mikro-orm/core';
import { Server, Socket } from 'socket.io';
import { ChannelService } from './channel.service';
import { Channel } from './channel';
import * as process from 'process';
@WebSocketGateway({
cors: {
origin: process.env.FRONTEND_URL,
},
})
const WEB_SOCKET_OPTIONS =
process.env.NODE_ENV === 'production'
? {}
: { cors: { origin: process.env.FRONTEND_URL } };
@WebSocketGateway(WEB_SOCKET_OPTIONS)
export class ChannelGateway implements OnGatewayConnection {
@WebSocketServer()
public server: Server;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment