fix: harden backend production deployment
This commit is contained in:
@@ -2,6 +2,8 @@ import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { AppStatusResponseDto } from './business/shared';
|
||||
|
||||
const packageJson: { version: string } = require('../package.json');
|
||||
|
||||
/**
|
||||
* 应用服务类
|
||||
*
|
||||
@@ -31,7 +33,7 @@ export class AppService {
|
||||
|
||||
return {
|
||||
service: 'Pixel Game Server',
|
||||
version: '1.1.1',
|
||||
version: packageJson.version,
|
||||
status: 'running',
|
||||
timestamp: new Date().toISOString(),
|
||||
uptime: Math.floor((Date.now() - this.startTime) / 1000),
|
||||
|
||||
@@ -354,7 +354,7 @@ export function validateZulipConfig(
|
||||
errors.push('API Key加密密钥长度必须至少32字符');
|
||||
}
|
||||
|
||||
if (!config.server.botApiKey) {
|
||||
if (!config.server.botApiKey && !config.errorHandling.degradedModeEnabled) {
|
||||
errors.push('生产环境必须配置Zulip机器人API Key');
|
||||
}
|
||||
}
|
||||
@@ -405,4 +405,4 @@ function isValidEmail(email: string): boolean {
|
||||
*/
|
||||
export const zulipConfig = registerAs('zulip', () => {
|
||||
return loadZulipConfigFromEnv();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user