From 076a38c9cfa6e0f6e09e328fbfc9c902b8de4517 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Thu, 24 Jul 2025 00:33:58 +0200 Subject: [PATCH] testapp: update environment variables and enhance config service for better clarity --- testapp/.env | 6 +++--- testapp/src/controllers/roomController.ts | 3 ++- testapp/src/index.ts | 1 + testapp/src/services/configService.ts | 10 ++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/testapp/.env b/testapp/.env index 809f178..c750491 100644 --- a/testapp/.env +++ b/testapp/.env @@ -1,4 +1,4 @@ -OPENVIDU_MEET_URL=http://localhost:6080/api/v1 -WEBCOMPONENT_SRC=http://localhost:6080/v1/openvidu-meet.js +SERVER_PORT=5080 +MEET_API_URL=http://localhost:6080/api/v1 MEET_API_KEY=meet-api-key -PORT=5080 +MEET_WEBCOMPONENT_SRC=http://localhost:6080/v1/openvidu-meet.js diff --git a/testapp/src/controllers/roomController.ts b/testapp/src/controllers/roomController.ts index 88a878f..933e829 100644 --- a/testapp/src/controllers/roomController.ts +++ b/testapp/src/controllers/roomController.ts @@ -3,6 +3,7 @@ import { Server as IOServer } from 'socket.io'; import { ParticipantRole } from '../../../typings/src/participant'; // @ts-ignore import { MeetWebhookEvent } from '../../../typings/src/webhook.model'; +import { configService } from '../services/configService'; interface JoinRoomRequest { participantRole: ParticipantRole; @@ -31,7 +32,7 @@ export const joinRoom = (req: Request, res: Response) => { participantName, roomId, showOnlyRecordings: showOnlyRecordings || false, - webcomponentSrc: process.env.WEBCOMPONENT_SRC + webcomponentSrc: configService.meetWebhookSrc }); } catch (error) { console.error('Error joining room:', error); diff --git a/testapp/src/index.ts b/testapp/src/index.ts index a6f0e28..faa133c 100644 --- a/testapp/src/index.ts +++ b/testapp/src/index.ts @@ -51,4 +51,5 @@ server.listen(PORT, () => { console.log('OpenVidu Meet Configuration:'); console.log(`Meet API URL: ${configService.meetApiUrl}`); console.log(`Meet API key: ${configService.meetApiKey}`); + console.log(`Meet Webcomponent Source: ${configService.meetWebhookSrc}`); }); diff --git a/testapp/src/services/configService.ts b/testapp/src/services/configService.ts index 8d4ffd4..0356024 100644 --- a/testapp/src/services/configService.ts +++ b/testapp/src/services/configService.ts @@ -3,14 +3,16 @@ import dotenv from 'dotenv'; dotenv.config(); export class ConfigService { + public serverPort: number; public meetApiUrl: string; public meetApiKey: string; - public serverPort: number; + public meetWebhookSrc: string; constructor() { - this.meetApiUrl = process.env.OPENVIDU_MEET_URL!; - this.meetApiKey = process.env.MEET_API_KEY!; - this.serverPort = parseInt(process.env.PORT!, 10); + this.serverPort = process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT, 10) : 5080; + this.meetApiUrl = process.env.MEET_API_URL || 'http://localhost:6080/api/v1'; + this.meetApiKey = process.env.MEET_API_KEY || 'meet-api-key'; + this.meetWebhookSrc = process.env.MEET_WEBCOMPONENT_SRC || 'http://localhost:6080/v1/openvidu-meet.js'; } }