제어관리 외부커넥션 설정기능

This commit is contained in:
kjs
2025-09-26 01:28:51 +09:00
parent 1a59c0cf04
commit 2a4e379dc4
43 changed files with 7129 additions and 316 deletions

View File

@@ -1,15 +1,20 @@
import { PrismaClient } from "@prisma/client";
import config from "./environment";
// Prisma 클라이언트 인스턴스 생성
const prisma = new PrismaClient({
datasources: {
db: {
url: config.databaseUrl,
// Prisma 클라이언트 생성 함수
function createPrismaClient() {
return new PrismaClient({
datasources: {
db: {
url: config.databaseUrl,
},
},
},
log: config.debug ? ["query", "info", "warn", "error"] : ["error"],
});
log: config.debug ? ["query", "info", "warn", "error"] : ["error"],
});
}
// 단일 인스턴스 생성
const prisma = createPrismaClient();
// 데이터베이스 연결 테스트
async function testConnection() {
@@ -41,4 +46,5 @@ if (config.nodeEnv === "development") {
testConnection();
}
export default prisma;
// 기본 내보내기
export = prisma;

View File

@@ -80,7 +80,7 @@ const getCorsOrigin = (): string[] | boolean => {
const config: Config = {
// 서버 설정
port: parseInt(process.env.PORT || "3000", 10),
port: parseInt(process.env.PORT || "8080", 10),
host: process.env.HOST || "0.0.0.0",
nodeEnv: process.env.NODE_ENV || "development",