gzdaniel commited on
Commit
367afab
·
1 Parent(s): 76d49de

Optimize default setting of PostgreSQL

Browse files
Files changed (1) hide show
  1. lightrag/kg/postgres_impl.py +9 -9
lightrag/kg/postgres_impl.py CHANGED
@@ -49,13 +49,13 @@ MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000))
49
 
50
  class PostgreSQLDB:
51
  def __init__(self, config: dict[str, Any], **kwargs: Any):
52
- self.host = config.get("host", "localhost")
53
- self.port = config.get("port", 5432)
54
- self.user = config.get("user", "postgres")
55
- self.password = config.get("password", None)
56
- self.database = config.get("database", "postgres")
57
- self.workspace = config.get("workspace", "default")
58
- self.max = int(config.get("max_connections", 20))
59
  self.increment = 1
60
  self.pool: Pool | None = None
61
 
@@ -298,7 +298,7 @@ class ClientManager:
298
  "POSTGRES_PORT", config.get("postgres", "port", fallback=5432)
299
  ),
300
  "user": os.environ.get(
301
- "POSTGRES_USER", config.get("postgres", "user", fallback=None)
302
  ),
303
  "password": os.environ.get(
304
  "POSTGRES_PASSWORD",
@@ -306,7 +306,7 @@ class ClientManager:
306
  ),
307
  "database": os.environ.get(
308
  "POSTGRES_DATABASE",
309
- config.get("postgres", "database", fallback=None),
310
  ),
311
  "workspace": os.environ.get(
312
  "POSTGRES_WORKSPACE",
 
49
 
50
  class PostgreSQLDB:
51
  def __init__(self, config: dict[str, Any], **kwargs: Any):
52
+ self.host = config["host"]
53
+ self.port = config["port"]
54
+ self.user = config["user"]
55
+ self.password = config["password"]
56
+ self.database = config["database"]
57
+ self.workspace = config["workspace"]
58
+ self.max = int(config["max_connections"])
59
  self.increment = 1
60
  self.pool: Pool | None = None
61
 
 
298
  "POSTGRES_PORT", config.get("postgres", "port", fallback=5432)
299
  ),
300
  "user": os.environ.get(
301
+ "POSTGRES_USER", config.get("postgres", "user", fallback="postgres")
302
  ),
303
  "password": os.environ.get(
304
  "POSTGRES_PASSWORD",
 
306
  ),
307
  "database": os.environ.get(
308
  "POSTGRES_DATABASE",
309
+ config.get("postgres", "database", fallback="postgres"),
310
  ),
311
  "workspace": os.environ.get(
312
  "POSTGRES_WORKSPACE",