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
|
OPENVIDU_MEET_URL=http://localhost:6080/meet/api/v1
|
||||||
API_KEY=meet-api-key
|
MEET_API_KEY=meet-api-key
|
||||||
PORT=5080
|
PORT=5080
|
||||||
|
|||||||
@ -41,7 +41,7 @@ app.post('/webhook', (req, res) => {
|
|||||||
handleWebhook(req, res, io);
|
handleWebhook(req, res, io);
|
||||||
});
|
});
|
||||||
|
|
||||||
const PORT = configService.port;
|
const PORT = configService.serverPort;
|
||||||
server.listen(PORT, () => {
|
server.listen(PORT, () => {
|
||||||
console.log('-----------------------------------------');
|
console.log('-----------------------------------------');
|
||||||
console.log(`Server running on port ${PORT}`);
|
console.log(`Server running on port ${PORT}`);
|
||||||
@ -52,6 +52,6 @@ server.listen(PORT, () => {
|
|||||||
|
|
||||||
console.log('Environment variables:');
|
console.log('Environment variables:');
|
||||||
console.log(`OPENVIDU_MEET_URL: ${process.env.OPENVIDU_MEET_URL}`);
|
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}`);
|
console.log(`PORT: ${process.env.PORT}`);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,15 +3,15 @@ import dotenv from 'dotenv';
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
export class ConfigService {
|
export class ConfigService {
|
||||||
public meetApiUrl: string;
|
public meetApiUrl: string;
|
||||||
public apiKey: string;
|
public meetApiKey: string;
|
||||||
public port: number;
|
public serverPort: number;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.meetApiUrl = process.env.OPENVIDU_MEET_URL || 'http://localhost:6080/meet/api/v1';
|
this.meetApiUrl = process.env.OPENVIDU_MEET_URL!;
|
||||||
this.apiKey = process.env.API_KEY || 'meet-api-key';
|
this.meetApiKey = process.env.MEET_API_KEY!;
|
||||||
this.port = parseInt(process.env.PORT || '5080', 10);
|
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;
|
pagination: any;
|
||||||
recordings: MeetRecordingInfo[];
|
recordings: MeetRecordingInfo[];
|
||||||
}>(url, {
|
}>(url, {
|
||||||
headers: { 'x-api-key': configService.apiKey },
|
headers: { 'x-api-key': configService.meetApiKey },
|
||||||
});
|
});
|
||||||
|
|
||||||
while (pagination.isTruncated) {
|
while (pagination.isTruncated) {
|
||||||
@ -21,7 +21,7 @@ export const getAllRecordings = async (): Promise<{
|
|||||||
pagination: any;
|
pagination: any;
|
||||||
recordings: MeetRecordingInfo[];
|
recordings: MeetRecordingInfo[];
|
||||||
}>(nextPageUrl, {
|
}>(nextPageUrl, {
|
||||||
headers: { 'x-api-key': configService.apiKey },
|
headers: { 'x-api-key': configService.meetApiKey },
|
||||||
});
|
});
|
||||||
recordings.push(...nextPageResult.recordings);
|
recordings.push(...nextPageResult.recordings);
|
||||||
pagination = nextPageResult.pagination;
|
pagination = nextPageResult.pagination;
|
||||||
@ -36,6 +36,6 @@ export const deleteAllRecordings = async (
|
|||||||
configService.meetApiUrl
|
configService.meetApiUrl
|
||||||
}/recordings?recordingIds=${recordingIds.join(',')}`;
|
}/recordings?recordingIds=${recordingIds.join(',')}`;
|
||||||
await del<void>(url, {
|
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`;
|
const url = `${configService.meetApiUrl}/rooms`;
|
||||||
return get<{ pagination: any; rooms: MeetRoom[] }>(url, {
|
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();
|
roomData.autoDeletionDate = new Date(Date.now() + 60 * 61 * 1000).getTime();
|
||||||
console.log('Creating room with options:', roomData);
|
console.log('Creating room with options:', roomData);
|
||||||
return post<MeetRoom>(url, {
|
return post<MeetRoom>(url, {
|
||||||
headers: { 'x-api-key': configService.apiKey },
|
headers: { 'x-api-key': configService.meetApiKey },
|
||||||
body: roomData,
|
body: roomData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ export async function createRoom(roomData: MeetRoomOptions): Promise<MeetRoom> {
|
|||||||
export async function deleteRoom(roomId: string): Promise<void> {
|
export async function deleteRoom(roomId: string): Promise<void> {
|
||||||
const url = `${configService.meetApiUrl}/rooms/${roomId}`;
|
const url = `${configService.meetApiUrl}/rooms/${roomId}`;
|
||||||
await del<void>(url, {
|
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(',')}`;
|
const url = `${configService.meetApiUrl}/rooms?roomIds=${roomIds.join(',')}`;
|
||||||
|
|
||||||
await del<void>(url, {
|
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