From f34eb0e210467cc339752458720fab8e4e171634 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Fri, 1 Aug 2025 13:45:54 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20=EB=B0=B1=EC=97=94=EB=93=9C=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=B2=A0=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - localhost에서 postgres 컨테이너명으로 변경 - Docker 환경에서 컨테이너 간 통신 가능하도록 개선 - 환경변수를 통한 DATABASE_URL 오버라이드 지원 --- backend/app/database.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/database.py b/backend/app/database.py index b425a14..0435325 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -3,8 +3,11 @@ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import os -# 데이터베이스 URL -DATABASE_URL = "postgresql://tkmp_user:tkmp_password_2025@localhost:5432/tk_mp_bom" +# 데이터베이스 URL (환경변수에서 읽거나 기본값 사용) +DATABASE_URL = os.getenv( + "DATABASE_URL", + "postgresql://tkmp_user:tkmp_password_2025@postgres:5432/tk_mp_bom" +) # SQLAlchemy 엔진 생성 engine = create_engine(DATABASE_URL)