Refactors storage to use a database backend, introducing schemas and functions for routers, network logs, detections, whitelist, and training history. Integrates Drizzle ORM with Neon Postgres for data persistence. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 4e9219bb-e0f1-4799-bb3f-6c759dc16069 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/c9ITWqD
16 lines
483 B
TypeScript
16 lines
483 B
TypeScript
import { Pool, neonConfig } from '@neondatabase/serverless';
|
|
import { drizzle } from 'drizzle-orm/neon-serverless';
|
|
import ws from "ws";
|
|
import * as schema from "@shared/schema";
|
|
|
|
neonConfig.webSocketConstructor = ws;
|
|
|
|
if (!process.env.DATABASE_URL) {
|
|
throw new Error(
|
|
"DATABASE_URL must be set. Did you forget to provision a database?",
|
|
);
|
|
}
|
|
|
|
export const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
export const db = drizzle({ client: pool, schema });
|