From ecd63053ba38429cc317de377f978306c2db6f36 Mon Sep 17 00:00:00 2001 From: Jerryplusy Date: Tue, 26 Aug 2025 17:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .envExample | 3 --- src/config/config.service.ts | 8 +------- src/core/ws/ws.gateway.ts | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.envExample b/.envExample index 7d3078d..7ab03af 100644 --- a/.envExample +++ b/.envExample @@ -1,7 +1,4 @@ -PORT=4000 -DEBUG=true RD_PORT=6379 RD_ADD=127.0.0.1 WS_SECRET=114514 -WS_PORT=4001 TOKEN=54188 diff --git a/src/config/config.service.ts b/src/config/config.service.ts index 5a08cdf..5b7d3f5 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -32,13 +32,7 @@ export class AppConfigService implements OnModuleInit { private checkRequiredVariables(): void { this.logger.log('检查必要环境变量..'); - const requiredVariables = [ - 'PORT', - 'RD_PORT', - 'RD_ADD', - 'WS_SECRET', - 'WS_PORT', - ]; + const requiredVariables = ['RD_PORT', 'RD_ADD', 'WS_SECRET']; requiredVariables.forEach((key) => { const value = this.nestConfigService.get(key); diff --git a/src/core/ws/ws.gateway.ts b/src/core/ws/ws.gateway.ts index 975c691..cfcde60 100644 --- a/src/core/ws/ws.gateway.ts +++ b/src/core/ws/ws.gateway.ts @@ -16,7 +16,7 @@ import { import { AppConfigService } from '../../config/config.service'; import { WsMessageHandler } from './ws-message.handler'; -@WebSocketGateway(7001, { +@WebSocketGateway({ cors: { origin: '*' }, driver: 'ws', })