Update environment variable loading to allow overrides
- Modified load_dotenv() calls in multiple files to include override=True, ensuring that .env variables can replace existing environment variables. - Updated ota_storage.py to use default values for OTA upload directories, improving clarity and maintainability. - Enhanced get_ota_upload_dir() function to read environment variables dynamically, ensuring accurate directory paths based on the current environment.
This commit is contained in:
+2
-2
@@ -4,8 +4,8 @@ from sqlalchemy.orm import sessionmaker
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
# Load environment variables(override=True:.env 覆盖已有环境变量,避免系统里 DEBUG=true 导致与 .env 中 DEBUG=False 冲突)
|
||||
load_dotenv(override=True)
|
||||
|
||||
# Database configuration
|
||||
DATABASE_HOST = os.getenv("DATABASE_HOST", "localhost")
|
||||
|
||||
Reference in New Issue
Block a user