chore: add dev containers

This commit is contained in:
BennyKok
2024-01-20 22:38:31 +08:00
parent e400966117
commit e344c3e6a4
7 changed files with 92 additions and 6 deletions
+9 -1
View File
@@ -2,10 +2,18 @@ import * as schema from "./schema";
import { neonConfig, Pool } from "@neondatabase/serverless";
import { drizzle as neonDrizzle } from "drizzle-orm/neon-serverless";
const isDevContainer = process.env.REMOTE_CONTAINERS !== undefined;
// if we're running locally
if (process.env.VERCEL_ENV !== "production") {
// Set the WebSocket proxy to work with the local instance
neonConfig.wsProxy = (host) => `${host}:5481/v1`;
if (isDevContainer) {
// Running inside a VS Code devcontainer
neonConfig.wsProxy = (host) => `host.docker.internal:5481/v1`;
} else {
// Not running inside a VS Code devcontainer
neonConfig.wsProxy = (host) => `${host}:5481/v1`;
}
// Disable all authentication and encryption
neonConfig.useSecureWebSocket = false;
neonConfig.pipelineTLS = false;