Optimize default setting of PostgreSQL
Browse files
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
|
53 |
-
self.port = config
|
54 |
-
self.user = config
|
55 |
-
self.password = config
|
56 |
-
self.database = config
|
57 |
-
self.workspace = config
|
58 |
-
self.max = int(config
|
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=
|
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=
|
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",
|