Prioritize OS environment variables over .env file to improve Docker compatibility for the server

This commit is contained in:
yangdx
2025-03-21 13:27:12 +08:00
parent 168232803b
commit 67eee2d2d5
4 changed files with 5 additions and 3 deletions

View File

@@ -3,7 +3,9 @@ from datetime import datetime, timedelta
import jwt import jwt
from fastapi import HTTPException, status from fastapi import HTTPException, status
from pydantic import BaseModel from pydantic import BaseModel
from dotenv import load_dotenv
load_dotenv()
class TokenPayload(BaseModel): class TokenPayload(BaseModel):
sub: str # Username sub: str # Username

View File

@@ -49,7 +49,7 @@ from .auth import auth_handler
# Load environment variables # Load environment variables
# Updated to use the .env that is inside the current folder # Updated to use the .env that is inside the current folder
# This update allows the user to put a different.env file for each lightrag folder # This update allows the user to put a different.env file for each lightrag folder
load_dotenv(".env", override=True) load_dotenv()
# Initialize config parser # Initialize config parser
config = configparser.ConfigParser() config = configparser.ConfigParser()

View File

@@ -13,7 +13,7 @@ from dotenv import load_dotenv
# Updated to use the .env that is inside the current folder # Updated to use the .env that is inside the current folder
# This update allows the user to put a different.env file for each lightrag folder # This update allows the user to put a different.env file for each lightrag folder
load_dotenv(".env") load_dotenv()
def check_and_install_dependencies(): def check_and_install_dependencies():

View File

@@ -16,7 +16,7 @@ from starlette.status import HTTP_403_FORBIDDEN
from .auth import auth_handler from .auth import auth_handler
# Load environment variables # Load environment variables
load_dotenv(override=True) load_dotenv()
global_args = {"main_args": None} global_args = {"main_args": None}