gzdaniel commited on
Commit
0c81460
·
1 Parent(s): de280e6

Add NEO4J_WORKSPACE env var override support

Browse files

- Allow workspace override via NEO4J_WORKSPACE
- Update env.example with new config option

Files changed (2) hide show
  1. env.example +1 -0
  2. lightrag/kg/neo4j_impl.py +5 -0
env.example CHANGED
@@ -156,6 +156,7 @@ POSTGRES_MAX_CONNECTIONS=12
156
  NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
157
  NEO4J_USERNAME=neo4j
158
  NEO4J_PASSWORD='your_password'
 
159
 
160
  ### MongoDB Configuration
161
  MONGO_URI=mongodb://root:root@localhost:27017/
 
156
  NEO4J_URI=neo4j+s://xxxxxxxx.databases.neo4j.io
157
  NEO4J_USERNAME=neo4j
158
  NEO4J_PASSWORD='your_password'
159
+ # NEO4J_WORKSPACE=forced_workspace_name
160
 
161
  ### MongoDB Configuration
162
  MONGO_URI=mongodb://root:root@localhost:27017/
lightrag/kg/neo4j_impl.py CHANGED
@@ -51,6 +51,11 @@ logging.getLogger("neo4j").setLevel(logging.ERROR)
51
  @dataclass
52
  class Neo4JStorage(BaseGraphStorage):
53
  def __init__(self, namespace, global_config, embedding_func, workspace=None):
 
 
 
 
 
54
  super().__init__(
55
  namespace=namespace,
56
  workspace=workspace or "",
 
51
  @dataclass
52
  class Neo4JStorage(BaseGraphStorage):
53
  def __init__(self, namespace, global_config, embedding_func, workspace=None):
54
+ # Check NEO4J_WORKSPACE environment variable and override workspace if set
55
+ neo4j_workspace = os.environ.get("NEO4J_WORKSPACE")
56
+ if neo4j_workspace and neo4j_workspace.strip():
57
+ workspace = neo4j_workspace
58
+
59
  super().__init__(
60
  namespace=namespace,
61
  workspace=workspace or "",