- WebServerConfig.cors_origins(list) 추가, config 의 오리진이 있을 때만 CORSMiddleware 적용 - 명시적 오리진이라 allow_credentials=true (Authorization 헤더 허용) - 로컬 기본값: http://localhost:5173, http://127.0.0.1:5173 (Vite) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
46 lines
1.4 KiB
Python
46 lines
1.4 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 = ""
|
|
|
|
|
|
class JwtToken(ConfigModel):
|
|
access_key: str = ""
|
|
refresh_key: str = ""
|
|
access_expire_min: int = 30
|
|
refresh_expire_day: int = 7
|