@@ -1,10 +1,10 @@
|
||||
import cluster from 'node:cluster'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { Logger } from '@innei/pretty-logger-nestjs'
|
||||
import wcmatch from 'wildcard-match'
|
||||
|
||||
import { NestFactory } from '@nestjs/core'
|
||||
|
||||
import wcmatch from 'wildcard-match'
|
||||
|
||||
import { CROSS_DOMAIN, DEBUG_MODE, PORT } from './app.config'
|
||||
import { AppModule } from './app.module'
|
||||
import { fastifyApp } from './common/adapters/fastify.adapter'
|
||||
@@ -14,10 +14,9 @@ import { LoggingInterceptor } from './common/interceptors/logging.interceptor'
|
||||
import { ExtendedValidationPipe } from './common/pipes/validation.pipe'
|
||||
import { logger } from './global/consola.global'
|
||||
import { isMainProcess, isTest } from './global/env.global'
|
||||
import { migrateDatabase } from './migration/migrate'
|
||||
import { checkInit } from './utils/check-init.util'
|
||||
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
|
||||
import type { LogLevel } from '@nestjs/common'
|
||||
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
|
||||
|
||||
const Origin: false | string[] = Array.isArray(CROSS_DOMAIN.allowedOrigins)
|
||||
? [...CROSS_DOMAIN.allowedOrigins, '*.shizuri.net', '22333322.xyz']
|
||||
@@ -26,10 +25,6 @@ const Origin: false | string[] = Array.isArray(CROSS_DOMAIN.allowedOrigins)
|
||||
declare const module: any
|
||||
|
||||
export async function bootstrap() {
|
||||
if (isMainProcess) {
|
||||
await migrateDatabase()
|
||||
}
|
||||
|
||||
const isInit = await checkInit()
|
||||
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// register global
|
||||
import cluster from 'node:cluster'
|
||||
|
||||
import { logger } from './global/consola.global'
|
||||
import { isMainCluster } from './global/env.global'
|
||||
import { register } from './global/index.global'
|
||||
import { registerForMemoryDump } from './dump'
|
||||
import { DEBUG_MODE } from './app.config'
|
||||
import { registerForMemoryDump } from './dump'
|
||||
import { logger } from './global/consola.global'
|
||||
import { isMainCluster, isMainProcess } from './global/env.global'
|
||||
import { register } from './global/index.global'
|
||||
import { migrateDatabase } from './migration/migrate'
|
||||
|
||||
process.title = `Mix Space (${cluster.isPrimary ? 'master' : 'worker'}) - ${
|
||||
process.env.NODE_ENV
|
||||
@@ -14,6 +15,11 @@ process.title = `Mix Space (${cluster.isPrimary ? 'master' : 'worker'}) - ${
|
||||
|
||||
async function main() {
|
||||
register()
|
||||
|
||||
if (isMainProcess) {
|
||||
await migrateDatabase()
|
||||
}
|
||||
|
||||
const [{ bootstrap }, { CLUSTER, ENCRYPT }, { Cluster }] = await Promise.all([
|
||||
import('./bootstrap'),
|
||||
import('./app.config'),
|
||||
|
||||
Reference in New Issue
Block a user