mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-28 00:23:08 +02:00
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { ChartManagementService } from '@/core/chart/ChartManagementService.js';
|
|
import { QueueProcessorService } from '@/queue/QueueProcessorService.js';
|
|
import { NestLogger } from '@/NestLogger.js';
|
|
import { QueueProcessorModule } from '@/queue/QueueProcessorModule.js';
|
|
import { QueueStatsService } from '@/daemons/QueueStatsService.js';
|
|
import { ServerStatsService } from '@/daemons/ServerStatsService.js';
|
|
import { ServerService } from '@/server/ServerService.js';
|
|
import { MainModule } from '@/MainModule.js';
|
|
|
|
export async function server() {
|
|
const app = await NestFactory.createApplicationContext(MainModule, {
|
|
logger: new NestLogger(),
|
|
});
|
|
app.enableShutdownHooks();
|
|
|
|
const serverService = app.get(ServerService);
|
|
await serverService.launch();
|
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
app.get(ChartManagementService).start();
|
|
app.get(QueueStatsService).start();
|
|
app.get(ServerStatsService).start();
|
|
}
|
|
|
|
return app;
|
|
}
|
|
|
|
export async function jobQueue() {
|
|
const jobQueue = await NestFactory.createApplicationContext(QueueProcessorModule, {
|
|
logger: new NestLogger(),
|
|
});
|
|
jobQueue.enableShutdownHooks();
|
|
|
|
jobQueue.get(QueueProcessorService).start();
|
|
jobQueue.get(ChartManagementService).start();
|
|
|
|
return jobQueue;
|
|
}
|