refactor:重构安全模块架构,将security模块迁移至core层

- 将src/business/security模块迁移至src/core/security_core
- 更新模块导入路径和依赖关系
- 统一安全相关组件的命名规范(content_type.middleware.ts)
- 清理过时的配置文件和文档
- 更新架构文档以反映新的模块结构

此次重构符合业务功能模块化架构设计原则,将技术基础设施
服务统一放置在core层,提高代码组织的清晰度和可维护性。
This commit is contained in:
moyin
2026-01-04 19:34:16 +08:00
parent 67ade48ad7
commit 70c020a97c
25 changed files with 174 additions and 1215 deletions

View File

@@ -139,10 +139,39 @@ export class ConfigManagerService implements OnModuleDestroy {
private configLoadTime: Date;
private configWatcher: fs.FSWatcher | null = null;
private isWatcherEnabled: boolean = false;
private readonly CONFIG_DIR = path.join(process.cwd(), 'config', 'zulip');
private readonly CONFIG_DIR = this.getConfigDir();
private readonly MAP_CONFIG_FILE = 'map-config.json';
private readonly logger = new Logger(ConfigManagerService.name);
/**
* 获取配置目录路径
*
* 在开发环境中使用 config/zulip
* 在生产环境中使用 dist/zulip (编译后的位置)
*/
private getConfigDir(): string {
const isDevelopment = process.env.NODE_ENV !== 'production';
if (isDevelopment) {
// 开发环境:使用源码目录
return path.join(process.cwd(), 'config', 'zulip');
} else {
// 生产环境:使用编译后的目录
const distConfigPath = path.join(process.cwd(), 'dist', 'zulip');
const rootConfigPath = path.join(process.cwd(), 'config', 'zulip');
// 优先使用 dist/zulip如果不存在则回退到 config/zulip
if (fs.existsSync(distConfigPath)) {
return distConfigPath;
} else if (fs.existsSync(rootConfigPath)) {
return rootConfigPath;
} else {
// 都不存在,使用默认路径
return distConfigPath;
}
}
}
constructor() {
this.logger.log('ConfigManagerService初始化完成');