testapp: update environment variables and enhance config service for better clarity

This commit is contained in:
juancarmore 2025-07-24 00:33:58 +02:00
parent 6ddb002561
commit 076a38c9cf
4 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -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}`);
});

View File

@ -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';
}
}