Merge pull request #1222 from danielaskdd/main
standardize .env loading behavior across modules
This commit is contained in:
@@ -24,9 +24,7 @@ def check_env_file():
|
|||||||
Returns True if should continue, False if should exit.
|
Returns True if should continue, False if should exit.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(".env"):
|
if not os.path.exists(".env"):
|
||||||
warning_msg = (
|
warning_msg = "Warning: Startup directory must contain .env file for multi-instance support."
|
||||||
"Warning: Startup directory must contain .env file for multi-instance support."
|
|
||||||
)
|
|
||||||
ASCIIColors.yellow(warning_msg)
|
ASCIIColors.yellow(warning_msg)
|
||||||
|
|
||||||
# Check if running in interactive terminal
|
# Check if running in interactive terminal
|
||||||
|
@@ -16,7 +16,10 @@ import numpy as np
|
|||||||
from .utils import EmbeddingFunc
|
from .utils import EmbeddingFunc
|
||||||
from .types import KnowledgeGraph
|
from .types import KnowledgeGraph
|
||||||
|
|
||||||
load_dotenv()
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
class TextChunkSchema(TypedDict):
|
class TextChunkSchema(TypedDict):
|
||||||
|
@@ -55,8 +55,10 @@ from .utils import (
|
|||||||
from .types import KnowledgeGraph
|
from .types import KnowledgeGraph
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
# Load environment variables
|
# use the .env that is inside the current folder
|
||||||
load_dotenv(override=True)
|
# 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)
|
||||||
|
|
||||||
# TODO: TO REMOVE @Yannick
|
# TODO: TO REMOVE @Yannick
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
@@ -38,8 +38,10 @@ from .prompt import GRAPH_FIELD_SEP, PROMPTS
|
|||||||
import time
|
import time
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
# Load environment variables
|
# use the .env that is inside the current folder
|
||||||
load_dotenv(override=True)
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
def chunking_by_token_size(
|
def chunking_by_token_size(
|
||||||
|
Reference in New Issue
Block a user