Commit 70ce1fca authored by nanahira's avatar nanahira

ensure startup order

parent bb3d2b16
Pipeline #6108 failed with stages
in 9 seconds
{ {
"name": "koishi-nestjs", "name": "koishi-nestjs",
"version": "1.0.19", "version": "1.0.20",
"description": "Koishi.js as Nest.js Module", "description": "Koishi.js as Nest.js Module",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
......
...@@ -51,7 +51,7 @@ const koishiContextProviderPrivate: Provider = { ...@@ -51,7 +51,7 @@ const koishiContextProviderPrivate: Provider = {
providers: [ providers: [
{ {
provide: KoishiService, provide: KoishiService,
inject: [KOISHI_MODULE_OPTIONS], inject: [KOISHI_MODULE_OPTIONS, KoishiLoggerService],
useFactory: async (options: KoishiModuleOptions) => { useFactory: async (options: KoishiModuleOptions) => {
const koishi = new KoishiService(options); const koishi = new KoishiService(options);
koishi._nestKoaTmpServer = createServer( koishi._nestKoaTmpServer = createServer(
......
...@@ -13,6 +13,7 @@ import { Server } from 'http'; ...@@ -13,6 +13,7 @@ import { Server } from 'http';
import Koa from 'koa'; import Koa from 'koa';
import KoaRouter from '@koa/router'; import KoaRouter from '@koa/router';
import KoaBodyParser from 'koa-bodyparser'; import KoaBodyParser from 'koa-bodyparser';
import { KoishiLoggerService } from './koishi-logger.service';
const nestLogger = new ConsoleLogger('koishi'); const nestLogger = new ConsoleLogger('koishi');
...@@ -20,10 +21,7 @@ const nestLogger = new ConsoleLogger('koishi'); ...@@ -20,10 +21,7 @@ const nestLogger = new ConsoleLogger('koishi');
export class KoishiService export class KoishiService
extends App extends App
implements OnModuleInit, OnApplicationBootstrap, OnModuleDestroy { implements OnModuleInit, OnApplicationBootstrap, OnModuleDestroy {
constructor( constructor(private readonly koishiModuleOptions: KoishiModuleOptions) {
@Inject(KOISHI_MODULE_OPTIONS)
private readonly koishiModuleOptions: KoishiModuleOptions,
) {
super({ super({
...koishiModuleOptions, ...koishiModuleOptions,
port: 0, port: 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment