From 2bfa1ed91fec90a1ec6c4bcddfba3265d957159d Mon Sep 17 00:00:00 2001 From: Luke Steyn Date: Tue, 31 Oct 2023 12:58:48 +0100 Subject: [PATCH] Added WS_PORT config to wsConnectionManager --- src/wsConnectionManager.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wsConnectionManager.ts b/src/wsConnectionManager.ts index 867a5fe..eea8707 100644 --- a/src/wsConnectionManager.ts +++ b/src/wsConnectionManager.ts @@ -6,6 +6,9 @@ import { WebSocket, WebSocketServer } from 'ws'; import { sleep } from './utils/utils'; import { RedisClient } from './utils/redisClient'; +// Set up env constants +require('dotenv').config(); + const app = express(); app.use(cors({ origin: '*' })); app.use(compression()); @@ -16,6 +19,7 @@ const wss = new WebSocketServer({ server, path: '/ws' }); const REDIS_HOST = process.env.REDIS_HOST || 'localhost'; const REDIS_PORT = process.env.REDIS_PORT || '6379'; +const WS_PORT = process.env.WS_PORT || '3000'; const REDIS_PASSWORD = process.env.REDIS_PASSWORD; async function main() { @@ -116,8 +120,8 @@ async function main() { }); }); - server.listen('3000', () => { - console.log('connection manager running on 3000'); + server.listen(WS_PORT, () => { + console.log(`connection manager running on ${WS_PORT}`); }); }