fix: 修复健康检查路径,添加 authorization-service 健康检查控制器
This commit is contained in:
parent
99589f666a
commit
f3ac5d3718
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(dir:*)",
|
||||
"Bash(npm install)",
|
||||
"Bash(npx prisma:*)",
|
||||
"Bash(npm test:*)",
|
||||
"Bash(npm run build:*)",
|
||||
"Bash(wsl -e bash -c:*)",
|
||||
"Bash(if exist dist rmdir /s /q dist)",
|
||||
"Bash(if exist nul del /f /q nul)",
|
||||
"Bash(if exist coverage rmdir /s /q coverage)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git restore:*)",
|
||||
"Bash(git commit:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { Controller, Get } from '@nestjs/common'
|
||||
import { ApiTags, ApiOperation } from '@nestjs/swagger'
|
||||
|
||||
@ApiTags('Health')
|
||||
@Controller('health')
|
||||
export class HealthController {
|
||||
@Get()
|
||||
@ApiOperation({ summary: '健康检查' })
|
||||
check() {
|
||||
return {
|
||||
status: 'ok',
|
||||
service: 'authorization-service',
|
||||
timestamp: new Date().toISOString(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
export * from './authorization.controller'
|
||||
export * from './admin-authorization.controller'
|
||||
export * from './health.controller'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { AuthorizationApplicationService, REFERRAL_REPOSITORY, TEAM_STATISTICS_R
|
|||
import { MonthlyAssessmentScheduler } from '@/application/schedulers'
|
||||
|
||||
// API
|
||||
import { AuthorizationController, AdminAuthorizationController } from '@/api/controllers'
|
||||
import { AuthorizationController, AdminAuthorizationController, HealthController } from '@/api/controllers'
|
||||
|
||||
// Shared
|
||||
import { JwtStrategy } from '@/shared/strategies'
|
||||
|
|
@ -69,7 +69,7 @@ const MockTeamStatisticsRepository = {
|
|||
RedisModule,
|
||||
KafkaModule,
|
||||
],
|
||||
controllers: [AuthorizationController, AdminAuthorizationController],
|
||||
controllers: [AuthorizationController, AdminAuthorizationController, HealthController],
|
||||
providers: [
|
||||
// Prisma
|
||||
PrismaService,
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3004/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3004/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
|
@ -453,7 +453,7 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3009/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3009/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
|
|
|||
Loading…
Reference in New Issue