backend 와 동일한 프레임워크로 lps/ 폴더를 신설한다. 구체적인 도메인 로직(크롤링/오픈API/최저가 산정)은 미정이라 골격만 구성한다. - FastAPI 부트스트랩(web_main/router) + lifespan·CORS·gzip·로그 미들웨어 + /healthz - TOML 설정 로더(APP_ENV) + pydantic config + DB env override - DB 세션 매니저(논리 DB × R/W, service→람다 위임) — 엔진 lazy 라 DB 없이도 부팅 - 공통 응답 규약(gmodel) + ErrorType/DBType/DBWRType - router→services→crud 계층 컨벤션(services/crud 는 빈 폴더로 자리만) - 포트 9400(backend 9300·agent 9500 회피), Dockerfile/run_local_server.sh/README - tests/test_health.py 스모크(healthz, DB 없이 통과) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from config.config_loader import ConfigModel
|
|
|
|
|
|
class WebServerConfig(ConfigModel):
|
|
server_name: str = ""
|
|
port: int = 0
|
|
process_count: int = 1
|
|
is_ssl: bool = False
|
|
is_test: bool = False
|
|
# CORS 허용 오리진(프론트). 비우면 CORS 미적용. 예: ["http://localhost:5173"]
|
|
cors_origins: list[str] = []
|
|
|
|
|
|
class LogConfig(ConfigModel):
|
|
print_console: bool = True
|
|
log_level: str = "debug"
|
|
|
|
|
|
# DB Read/Write 분리 설정.
|
|
# 하나의 논리 DB 에 대해 write(주) / read(복제) 접속 정보를 각각 가진다.
|
|
class MainDBConfig(ConfigModel):
|
|
db_type: str = "postgresql"
|
|
name: str = ""
|
|
write_host: str = ""
|
|
write_port: int = 5432
|
|
write_id: str = ""
|
|
write_pw: str = ""
|
|
read_host: str = ""
|
|
read_port: int = 5432
|
|
read_id: str = ""
|
|
read_pw: str = ""
|
|
show_log: bool = False
|
|
# 커넥션 풀 사이징. 실제 동시 커넥션 상한 = (pool_size + max_overflow) x 엔진수(R/W=2) x 워커수.
|
|
# PostgreSQL max_connections 를 넘지 않도록 설정해야 한다. (예: 10+20=30 x 2 x 5워커 = 300)
|
|
pool_size: int = 10
|
|
max_overflow: int = 20
|
|
# SSL/TLS 모드: ""/"disable"=미사용(로컬), "require"/"verify-ca"/"verify-full"=관리형 DB(RDS/Aurora/Azure).
|
|
sslmode: str = ""
|