63 lines
2.1 KiB
TypeScript
63 lines
2.1 KiB
TypeScript
import { Container } from 'inversify';
|
|
import {
|
|
AuthService,
|
|
LiveKitService,
|
|
LivekitWebhookService,
|
|
LoggerService,
|
|
MeetStorageService,
|
|
MutexService,
|
|
OpenViduWebhookService,
|
|
ParticipantService,
|
|
RecordingService,
|
|
RedisService,
|
|
RoomService,
|
|
S3Service,
|
|
S3StorageProvider,
|
|
StorageFactory,
|
|
SystemEventService,
|
|
TaskSchedulerService,
|
|
TokenService,
|
|
UserService
|
|
} from '../services/index.js';
|
|
|
|
export const container: Container = new Container();
|
|
|
|
/**
|
|
* Registers all necessary dependencies in the container.
|
|
*
|
|
* This function is responsible for registering services and other dependencies
|
|
* that are required by the application. It ensures that the dependencies are
|
|
* available for injection throughout the application.
|
|
*
|
|
*/
|
|
export const registerDependencies = () => {
|
|
console.log('Registering CE dependencies');
|
|
container.bind(LoggerService).toSelf().inSingletonScope();
|
|
container.bind(RedisService).toSelf().inSingletonScope();
|
|
container.bind(SystemEventService).toSelf().inSingletonScope();
|
|
container.bind(MutexService).toSelf().inSingletonScope();
|
|
container.bind(TaskSchedulerService).toSelf().inSingletonScope();
|
|
|
|
container.bind(S3Service).toSelf().inSingletonScope();
|
|
container.bind(S3StorageProvider).toSelf().inSingletonScope();
|
|
container.bind(StorageFactory).toSelf().inSingletonScope();
|
|
container.bind(MeetStorageService).toSelf().inSingletonScope();
|
|
|
|
container.bind(TokenService).toSelf().inSingletonScope();
|
|
container.bind(UserService).toSelf().inSingletonScope();
|
|
container.bind(AuthService).toSelf().inSingletonScope();
|
|
|
|
container.bind(LiveKitService).toSelf().inSingletonScope();
|
|
container.bind(RoomService).toSelf().inSingletonScope();
|
|
container.bind(ParticipantService).toSelf().inSingletonScope();
|
|
container.bind(RecordingService).toSelf().inSingletonScope();
|
|
container.bind(OpenViduWebhookService).toSelf().inSingletonScope();
|
|
container.bind(LivekitWebhookService).toSelf().inSingletonScope();
|
|
};
|
|
|
|
export const initializeEagerServices = async () => {
|
|
// Force the creation of services that need to be initialized at startup
|
|
container.get(RecordingService);
|
|
await container.get(MeetStorageService).initializeGlobalPreferences();
|
|
};
|