fix(config): enable overriding of environment variables when loading .env file
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user