fix: server di error

This commit is contained in:
Draculabo authored and vin committed 2026-01-10 01:07:09 +08:00
1 parent bc775d4fd6
commit 098cbe3eb9
6 files changed
+1328 -13

No files matched your search

+6 -2
View File
@@ -13,8 +13,12 @@ export const startGateway = async (port: number): Promise<boolean> => {
try {
// Stop if already running
await stopNestServer();
// Start NestJS server
return await bootstrapNestServer(port);
// Load full config and start NestJS server
const config = ConfigManager.loadConfig();
const proxyConfig = { ...config.proxy, port };
return await bootstrapNestServer(proxyConfig);
} catch (e) {
console.error('Failed to start gateway:', e);
return false;
+1
View File
@@ -1,3 +1,4 @@
import 'reflect-metadata';
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { AppModule } from './app.module';
+2 -2
View File
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Res, HttpStatus, UseGuards } from '@nestjs/common';
import { Controller, Get, Post, Body, Res, HttpStatus, UseGuards, Inject } from '@nestjs/common';
import { FastifyReply } from 'fastify';
import { ProxyService } from './proxy.service';
import { Observable } from 'rxjs';
@@ -8,7 +8,7 @@ import { ProxyGuard } from './proxy.guard';
@Controller('v1')
@UseGuards(ProxyGuard)
export class ProxyController {
constructor(private readonly proxyService: ProxyService) {}
constructor(@Inject(ProxyService) private readonly proxyService: ProxyService) {}
@Get('models')
getModels() {