testapp: update environment variables and enhance config service for better clarity
This commit is contained in:
parent
6ddb002561
commit
076a38c9cf
@ -1,4 +1,4 @@
|
|||||||
OPENVIDU_MEET_URL=http://localhost:6080/api/v1
|
SERVER_PORT=5080
|
||||||
WEBCOMPONENT_SRC=http://localhost:6080/v1/openvidu-meet.js
|
MEET_API_URL=http://localhost:6080/api/v1
|
||||||
MEET_API_KEY=meet-api-key
|
MEET_API_KEY=meet-api-key
|
||||||
PORT=5080
|
MEET_WEBCOMPONENT_SRC=http://localhost:6080/v1/openvidu-meet.js
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Server as IOServer } from 'socket.io';
|
|||||||
import { ParticipantRole } from '../../../typings/src/participant';
|
import { ParticipantRole } from '../../../typings/src/participant';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { MeetWebhookEvent } from '../../../typings/src/webhook.model';
|
import { MeetWebhookEvent } from '../../../typings/src/webhook.model';
|
||||||
|
import { configService } from '../services/configService';
|
||||||
|
|
||||||
interface JoinRoomRequest {
|
interface JoinRoomRequest {
|
||||||
participantRole: ParticipantRole;
|
participantRole: ParticipantRole;
|
||||||
@ -31,7 +32,7 @@ export const joinRoom = (req: Request, res: Response) => {
|
|||||||
participantName,
|
participantName,
|
||||||
roomId,
|
roomId,
|
||||||
showOnlyRecordings: showOnlyRecordings || false,
|
showOnlyRecordings: showOnlyRecordings || false,
|
||||||
webcomponentSrc: process.env.WEBCOMPONENT_SRC
|
webcomponentSrc: configService.meetWebhookSrc
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error joining room:', error);
|
console.error('Error joining room:', error);
|
||||||
|
|||||||
@ -51,4 +51,5 @@ server.listen(PORT, () => {
|
|||||||
console.log('OpenVidu Meet Configuration:');
|
console.log('OpenVidu Meet Configuration:');
|
||||||
console.log(`Meet API URL: ${configService.meetApiUrl}`);
|
console.log(`Meet API URL: ${configService.meetApiUrl}`);
|
||||||
console.log(`Meet API key: ${configService.meetApiKey}`);
|
console.log(`Meet API key: ${configService.meetApiKey}`);
|
||||||
|
console.log(`Meet Webcomponent Source: ${configService.meetWebhookSrc}`);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,14 +3,16 @@ import dotenv from 'dotenv';
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
export class ConfigService {
|
export class ConfigService {
|
||||||
|
public serverPort: number;
|
||||||
public meetApiUrl: string;
|
public meetApiUrl: string;
|
||||||
public meetApiKey: string;
|
public meetApiKey: string;
|
||||||
public serverPort: number;
|
public meetWebhookSrc: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.meetApiUrl = process.env.OPENVIDU_MEET_URL!;
|
this.serverPort = process.env.SERVER_PORT ? parseInt(process.env.SERVER_PORT, 10) : 5080;
|
||||||
this.meetApiKey = process.env.MEET_API_KEY!;
|
this.meetApiUrl = process.env.MEET_API_URL || 'http://localhost:6080/api/v1';
|
||||||
this.serverPort = parseInt(process.env.PORT!, 10);
|
this.meetApiKey = process.env.MEET_API_KEY || 'meet-api-key';
|
||||||
|
this.meetWebhookSrc = process.env.MEET_WEBCOMPONENT_SRC || 'http://localhost:6080/v1/openvidu-meet.js';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user