refactor: standardize .env loading behavior across modules

- Use .env from current folder for each lightrag instance
- Allow different .env files for different instances
- Make OS env vars take precedence over .env file
This commit is contained in:
yangdx
2025-03-29 03:37:23 +08:00
parent f165b4011d
commit c590d5878c
5 changed files with 20 additions and 13 deletions

View File

@@ -19,9 +19,10 @@ import tiktoken
from lightrag.prompt import PROMPTS
from dotenv import load_dotenv
# Load environment variables
load_dotenv(override=True)
# use the .env that is inside the current folder
# allows to use different .env file for each lightrag instance
# the OS environment variables take precedence over the .env file
load_dotenv(dotenv_path=".env", override=False)
VERBOSE_DEBUG = os.getenv("VERBOSE", "false").lower() == "true"