From e5c5a181d3184fa0e893a215bba800c252e4d609 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 18 Jan 2026 18:16:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E6=B7=BB=E5=8A=A0=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E5=8A=A0=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 集成 python-dotenv 库以支持 .env 文件 - 在主函数中添加 load_dotenv() 调用 - 实现环境配置的自动加载机制 --- index.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.py b/index.py index b02ddf1..df2476d 100644 --- a/index.py +++ b/index.py @@ -26,6 +26,8 @@ import time import signal import logging +from dotenv import load_dotenv + from domain.config import WorkerConfig from services.api_client import APIClientV2 from services.task_executor import TaskExecutor @@ -166,6 +168,9 @@ class WorkerV2: def main(): """主函数""" + # 加载 .env 文件(如果存在) + load_dotenv() + logger.info(f"RenderWorker v{SOFTWARE_VERSION}") # 创建并运行 Worker