testapp: rename API_KEY to MEET_API_KEY and update related references
This commit is contained in:
parent
8221368aa0
commit
dd1c27730e
@ -1,3 +1,3 @@
|
||||
OPENVIDU_MEET_URL=http://localhost:6080/meet/api/v1
|
||||
API_KEY=meet-api-key
|
||||
MEET_API_KEY=meet-api-key
|
||||
PORT=5080
|
||||
|
||||
@ -41,7 +41,7 @@ app.post('/webhook', (req, res) => {
|
||||
handleWebhook(req, res, io);
|
||||
});
|
||||
|
||||
const PORT = configService.port;
|
||||
const PORT = configService.serverPort;
|
||||
server.listen(PORT, () => {
|
||||
console.log('-----------------------------------------');
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
@ -52,6 +52,6 @@ server.listen(PORT, () => {
|
||||
|
||||
console.log('Environment variables:');
|
||||
console.log(`OPENVIDU_MEET_URL: ${process.env.OPENVIDU_MEET_URL}`);
|
||||
console.log(`API_KEY: ${process.env.API_KEY} `);
|
||||
console.log(`MEET_API_KEY: ${process.env.MEET_API_KEY} `);
|
||||
console.log(`PORT: ${process.env.PORT}`);
|
||||
});
|
||||
|
||||
@ -3,15 +3,15 @@ import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
export class ConfigService {
|
||||
public meetApiUrl: string;
|
||||
public apiKey: string;
|
||||
public port: number;
|
||||
public meetApiUrl: string;
|
||||
public meetApiKey: string;
|
||||
public serverPort: number;
|
||||
|
||||
constructor() {
|
||||
this.meetApiUrl = process.env.OPENVIDU_MEET_URL || 'http://localhost:6080/meet/api/v1';
|
||||
this.apiKey = process.env.API_KEY || 'meet-api-key';
|
||||
this.port = parseInt(process.env.PORT || '5080', 10);
|
||||
}
|
||||
constructor() {
|
||||
this.meetApiUrl = process.env.OPENVIDU_MEET_URL!;
|
||||
this.meetApiKey = process.env.MEET_API_KEY!;
|
||||
this.serverPort = parseInt(process.env.PORT!, 10);
|
||||
}
|
||||
}
|
||||
|
||||
export const configService = new ConfigService();
|
||||
export const configService = new ConfigService();
|
||||
|
||||
@ -12,7 +12,7 @@ export const getAllRecordings = async (): Promise<{
|
||||
pagination: any;
|
||||
recordings: MeetRecordingInfo[];
|
||||
}>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
|
||||
while (pagination.isTruncated) {
|
||||
@ -21,7 +21,7 @@ export const getAllRecordings = async (): Promise<{
|
||||
pagination: any;
|
||||
recordings: MeetRecordingInfo[];
|
||||
}>(nextPageUrl, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
recordings.push(...nextPageResult.recordings);
|
||||
pagination = nextPageResult.pagination;
|
||||
@ -36,6 +36,6 @@ export const deleteAllRecordings = async (
|
||||
configService.meetApiUrl
|
||||
}/recordings?recordingIds=${recordingIds.join(',')}`;
|
||||
await del<void>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@ export async function getAllRooms(): Promise<{
|
||||
}> {
|
||||
const url = `${configService.meetApiUrl}/rooms`;
|
||||
return get<{ pagination: any; rooms: MeetRoom[] }>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ export async function createRoom(roomData: MeetRoomOptions): Promise<MeetRoom> {
|
||||
roomData.autoDeletionDate = new Date(Date.now() + 60 * 61 * 1000).getTime();
|
||||
console.log('Creating room with options:', roomData);
|
||||
return post<MeetRoom>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
body: roomData,
|
||||
});
|
||||
}
|
||||
@ -28,7 +28,7 @@ export async function createRoom(roomData: MeetRoomOptions): Promise<MeetRoom> {
|
||||
export async function deleteRoom(roomId: string): Promise<void> {
|
||||
const url = `${configService.meetApiUrl}/rooms/${roomId}`;
|
||||
await del<void>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
}
|
||||
|
||||
@ -36,6 +36,6 @@ export async function deleteAllRooms(roomIds: string[]): Promise<void> {
|
||||
const url = `${configService.meetApiUrl}/rooms?roomIds=${roomIds.join(',')}`;
|
||||
|
||||
await del<void>(url, {
|
||||
headers: { 'x-api-key': configService.apiKey },
|
||||
headers: { 'x-api-key': configService.meetApiKey },
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user