import 'tsconfig-paths/register' ; import { App , Configuration , Logger } from '@midwayjs/decorator' ; import * as swagger from '@midwayjs/swagger' ; import { ILifeCycle } from '@midwayjs/core' ; import { IMidwayLogger } from '@midwayjs/logger' ; import * as jaeger from '@mw-components/jaeger' ; import * as jwt from '@mw-components/jwt' ; import * as koid from '@mw-components/koid' ; import { Application , NpmPkg } from '@/interface' ; import { customLogger } from './app/util/custom-logger' ; @ Configuration ( { imports : [ jaeger , koid , jwt , '@midwayjs/orm' , { component : swagger , enabledEnvironment : [ 'local' ] , } , ] , } ) export class ContainerConfiguration implements ILifeCycle { @ App ( ) app : Application ; @ Logger ( ) readonly logger : IMidwayLogger ; async onReady ( ) { this . app . config . pkgJson = this . app . config . pkg as NpmPkg ; customLogger ( this . logger , this . app ) ; const coreMiddlewareArr = this . app . config . coreMiddleware as string [ ] ; coreMiddlewareArr . splice ( 0 , 0 , 'errorHandlerMiddleware' ) ; coreMiddlewareArr . splice ( 1 , 0 , 'requestIdMiddleware' ) ; const { pkgJson } = this . app . config ; const info = { pkgName : pkgJson . name , pkgVersion : pkgJson . version , } ; console . log ( '✅ Your APP launched' , info ) ; } }