Browse Source

-fix:修复配置读取问题

LuoChinWen 1 month ago
parent
commit
8f8b6467e6
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/app/services/task_service.py

+ 12 - 0
src/app/services/task_service.py

@@ -903,6 +903,18 @@ class TaskService:
         try:
             from app.core.config import config_handler
             
+            # 强制重新加载配置文件
+            import os
+            current_dir = os.path.dirname(os.path.abspath(__file__))
+            config_file = os.path.join(current_dir, '..', 'config', 'config.ini')
+            config_file = os.path.abspath(config_file)
+            
+            logger.info(f"配置文件路径: {config_file}")
+            logger.info(f"配置文件是否存在: {os.path.exists(config_file)}")
+            
+            # 重新读取配置文件
+            config_handler.config.read(config_file, encoding='utf-8')
+            
             # 调试: 检查配置文件是否正确加载
             logger.info(f"配置文件sections: {config_handler.config.sections()}")