bc3aa31289
- auth/members/messages: 新增超级管理员登录、成员权限和密码消息流程 - agent-config/agent: 支持服务端保存 Agent 配置并取消未配置 mock 成功结果 - projects/deploy-runs/settings: 按当前用户权限保护真实接口 - prisma: 新增用户、项目权限和平台消息表结构
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import { AppModule } from './app.module';
|
|
import { ApiEnvelopeInterceptor } from './common/http/api-envelope.interceptor';
|
|
import { AllExceptionsFilter } from './common/http/all-exceptions.filter';
|
|
import { EnvConfig } from './config/env.schema';
|
|
|
|
async function bootstrap(): Promise<void> {
|
|
const app = await NestFactory.create(AppModule, {
|
|
bufferLogs: true,
|
|
rawBody: true,
|
|
});
|
|
const config = app.get(ConfigService<EnvConfig, true>);
|
|
const corsOrigin = config.get('CORS_ORIGIN', { infer: true });
|
|
|
|
app.enableCors({
|
|
origin: corsOrigin ? corsOrigin.split(',').map((origin) => origin.trim()) : true,
|
|
credentials: true,
|
|
});
|
|
app.useGlobalFilters(new AllExceptionsFilter());
|
|
app.useGlobalInterceptors(new ApiEnvelopeInterceptor());
|
|
|
|
const swaggerConfig = new DocumentBuilder()
|
|
.setTitle('运维平台 API')
|
|
.setDescription('提供 Jenkins、Gitea、通知、发布流程、账号权限和 Agent 运维能力接口。')
|
|
.setVersion('0.1.0')
|
|
.build();
|
|
const document = SwaggerModule.createDocument(app, swaggerConfig);
|
|
SwaggerModule.setup('docs', app, document);
|
|
|
|
await app.listen(config.get('PORT', { infer: true }));
|
|
}
|
|
|
|
void bootstrap();
|