fix(config): enable overriding of environment variables when loading .env file

This commit is contained in:
666ghj 2026-01-23 16:20:24 +08:00
parent 93e1a592df
commit 40f7035947

View file

@ -11,10 +11,10 @@ from dotenv import load_dotenv
project_root_env = os.path.join(os.path.dirname(__file__), '../../.env') project_root_env = os.path.join(os.path.dirname(__file__), '../../.env')
if os.path.exists(project_root_env): if os.path.exists(project_root_env):
load_dotenv(project_root_env) load_dotenv(project_root_env, override=True)
else: else:
# 如果根目录没有 .env尝试加载环境变量用于生产环境 # 如果根目录没有 .env尝试加载环境变量用于生产环境
load_dotenv() load_dotenv(override=True)
class Config: class Config: