backend: Exports internal config as a constant
Refactors the internal configuration to be exported as a constant, improving code modularity and preventing accidental modifications. Updates all files that use the internal config to import the constant instead of the default export.
This commit is contained in:
parent
8c110da405
commit
faa5934a17
@ -1 +1,2 @@
|
||||
export * from './dependency-injector.config.js';
|
||||
export * from './internal-config.js';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { StringValue } from 'ms';
|
||||
|
||||
const INTERNAL_CONFIG = {
|
||||
export const INTERNAL_CONFIG = {
|
||||
// Base paths for the API
|
||||
API_BASE_PATH_V1: '/api/v1',
|
||||
INTERNAL_API_BASE_PATH_V1: '/internal-api/v1',
|
||||
@ -63,5 +63,3 @@ const INTERNAL_CONFIG = {
|
||||
export const setInternalConfig = (overrides: Partial<typeof INTERNAL_CONFIG>): void => {
|
||||
Object.assign(INTERNAL_CONFIG, overrides);
|
||||
};
|
||||
|
||||
export default INTERNAL_CONFIG;
|
||||
|
||||
@ -2,7 +2,7 @@ import { AuthTransportMode } from '@openvidu-meet/typings';
|
||||
import { Request, Response } from 'express';
|
||||
import { ClaimGrants } from 'livekit-server-sdk';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import {
|
||||
errorInvalidCredentials,
|
||||
errorInvalidRefreshToken,
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
import { AuthTransportMode, OpenViduMeetPermissions, ParticipantOptions, ParticipantRole } from '@openvidu-meet/typings';
|
||||
import {
|
||||
AuthTransportMode,
|
||||
OpenViduMeetPermissions,
|
||||
ParticipantOptions,
|
||||
ParticipantRole
|
||||
} from '@openvidu-meet/typings';
|
||||
import { Request, Response } from 'express';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import {
|
||||
errorInvalidParticipantToken,
|
||||
errorParticipantTokenNotPresent,
|
||||
|
||||
@ -2,7 +2,7 @@ import archiver from 'archiver';
|
||||
import { Request, Response } from 'express';
|
||||
import { Readable } from 'stream';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { RecordingHelper } from '../helpers/index.js';
|
||||
import {
|
||||
errorRecordingNotFound,
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
} from '@openvidu-meet/typings';
|
||||
import { Request, Response } from 'express';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { handleError } from '../models/error.model.js';
|
||||
import { LoggerService, ParticipantService, RoomService } from '../services/index.js';
|
||||
import { getAuthTransportMode, getBaseUrl, getCookieOptions } from '../utils/index.js';
|
||||
|
||||
@ -4,7 +4,7 @@ import rateLimit from 'express-rate-limit';
|
||||
import { ClaimGrants } from 'livekit-server-sdk';
|
||||
import ms from 'ms';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import {
|
||||
errorInsufficientPermissions,
|
||||
errorInvalidApiKey,
|
||||
|
||||
@ -17,7 +17,7 @@ import {
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import ms from 'ms';
|
||||
import { z } from 'zod';
|
||||
import INTERNAL_CONFIG from '../../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../../config/internal-config.js';
|
||||
import { rejectUnprocessableRequest } from '../../models/error.model.js';
|
||||
|
||||
/**
|
||||
@ -92,7 +92,12 @@ const VirtualBackgroundConfigSchema: z.ZodType<MeetVirtualBackgroundConfig> = z.
|
||||
|
||||
const ThemeModeSchema: z.ZodType<MeetRoomThemeMode> = z.enum([MeetRoomThemeMode.LIGHT, MeetRoomThemeMode.DARK]);
|
||||
|
||||
const hexColorSchema = z.string().regex(/^#([0-9A-Fa-f]{8}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{3})$/, 'Must be a valid hex color code (with or without alpha)');
|
||||
const hexColorSchema = z
|
||||
.string()
|
||||
.regex(
|
||||
/^#([0-9A-Fa-f]{8}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{3})$/,
|
||||
'Must be a valid hex color code (with or without alpha)'
|
||||
);
|
||||
|
||||
const RoomThemeSchema = z.object({
|
||||
name: z
|
||||
|
||||
@ -3,7 +3,7 @@ import cookieParser from 'cookie-parser';
|
||||
import cors from 'cors';
|
||||
import express, { Express, Request, Response } from 'express';
|
||||
import { initializeEagerServices, registerDependencies } from './config/index.js';
|
||||
import INTERNAL_CONFIG from './config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from './config/internal-config.js';
|
||||
import { SERVER_CORS_ORIGIN, SERVER_PORT, logEnvVars } from './environment.js';
|
||||
import { httpContextMiddleware, jsonSyntaxErrorHandler } from './middlewares/index.js';
|
||||
import {
|
||||
|
||||
@ -2,7 +2,7 @@ import { inject, injectable } from 'inversify';
|
||||
import { RedisKeyName } from '../models/redis.model.js';
|
||||
import { LoggerService, RedisService } from './index.js';
|
||||
import ms from 'ms';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
|
||||
@injectable()
|
||||
export class ParticipantNameService {
|
||||
|
||||
@ -4,7 +4,7 @@ import { EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, RoomCompo
|
||||
import ms from 'ms';
|
||||
import { Readable } from 'stream';
|
||||
import { uid } from 'uid';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { MEET_S3_SUBBUCKET } from '../environment.js';
|
||||
import { MeetLock, RecordingHelper, UtilsHelper } from '../helpers/index.js';
|
||||
import {
|
||||
@ -322,10 +322,7 @@ export class RecordingService {
|
||||
await new Promise((resolve) => setTimeout(resolve, retryDelayMs * retryCount));
|
||||
}
|
||||
|
||||
const { failed } = await this.bulkDeleteRecordingsAndAssociatedFiles(
|
||||
remainingRecordings,
|
||||
roomId
|
||||
);
|
||||
const { failed } = await this.bulkDeleteRecordingsAndAssociatedFiles(remainingRecordings, roomId);
|
||||
|
||||
if (failed.length === 0) {
|
||||
this.logger.info(`Successfully deleted all recordings for room '${roomId}'`);
|
||||
|
||||
@ -18,7 +18,7 @@ import { CreateOptions, Room } from 'livekit-server-sdk';
|
||||
import ms from 'ms';
|
||||
import { uid as secureUid } from 'uid/secure';
|
||||
import { uid } from 'uid/single';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { MEET_NAME_ID } from '../environment.js';
|
||||
import { MeetRoomHelper, UtilsHelper } from '../helpers/index.js';
|
||||
import { validateRecordingTokenMetadata } from '../middlewares/index.js';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Bucket, File, GetFilesOptions, Storage } from '@google-cloud/storage';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { Readable } from 'stream';
|
||||
import INTERNAL_CONFIG from '../../../../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../../../../config/internal-config.js';
|
||||
import { MEET_S3_BUCKET, MEET_S3_SUBBUCKET } from '../../../../environment.js';
|
||||
import { errorS3NotAvailable, internalError } from '../../../../models/error.model.js';
|
||||
import { LoggerService } from '../../../index.js';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import INTERNAL_CONFIG from '../../../../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../../../../config/internal-config.js';
|
||||
import { RecordingHelper } from '../../../../helpers/recording.helper.js';
|
||||
import { StorageKeyBuilder } from '../../storage.interface.js';
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import {
|
||||
} from '@aws-sdk/client-s3';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { Readable } from 'stream';
|
||||
import INTERNAL_CONFIG from '../../../../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../../../../config/internal-config.js';
|
||||
import {
|
||||
MEET_AWS_REGION,
|
||||
MEET_S3_ACCESS_KEY,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { CronJob } from 'cron';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import ms from 'ms';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { MeetLock } from '../helpers/index.js';
|
||||
import { LoggerService, MutexService, DistributedEventService } from './index.js';
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { jwtDecode } from 'jwt-decode';
|
||||
import { AccessToken, AccessTokenOptions, ClaimGrants, TokenVerifier, VideoGrant } from 'livekit-server-sdk';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { LIVEKIT_API_KEY, LIVEKIT_API_SECRET, LIVEKIT_URL } from '../environment.js';
|
||||
import { LoggerService } from './index.js';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { User, UserDTO, UserRole } from '@openvidu-meet/typings';
|
||||
import { inject, injectable } from 'inversify';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { PasswordHelper } from '../helpers/password.helper.js';
|
||||
import { errorInvalidPassword, internalError } from '../models/error.model.js';
|
||||
import { MeetStorageService } from './index.js';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { AuthTransportMode } from '@openvidu-meet/typings';
|
||||
import { Request } from 'express';
|
||||
import { container } from '../config/index.js';
|
||||
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||
import { INTERNAL_CONFIG } from '../config/internal-config.js';
|
||||
import { LoggerService, MeetStorageService } from '../services/index.js';
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user