Initial commit: OpenClaw Memory System MVP

This commit is contained in:
daotong
2026-04-04 11:15:57 +00:00
commit f18f4daea5
14 changed files with 1389 additions and 0 deletions

27
src/db/pool.ts Normal file
View File

@@ -0,0 +1,27 @@
import pg from 'pg';
import dotenv from 'dotenv';
dotenv.config();
const { Pool } = pg;
export const pool = new Pool({
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT || '5432'),
database: process.env.DB_NAME || 'openclaw',
user: process.env.DB_USER || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
max: 20,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000,
});
// Test connection
pool.on('connect', () => {
console.log('✅ Connected to PostgreSQL');
});
pool.on('error', (err) => {
console.error('❌ PostgreSQL connection error:', err);
process.exit(-1);
});