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 client_url: str = "" # 관리자 프론트 오리진. CORS 허용 대상 landing_url: 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 # 외부 API 키. 수집 파이프라인(Perplexity → 카카오 로컬 → 크롤링 → Gemini)이 쓴다. # 키가 비면 해당 어댑터는 비활성 — 서버는 그대로 뜬다(부팅이 외부 계약에 묶이면 안 된다). class ExternalApiConfig(ConfigModel): perplexity_api_key: str = "" # 채널 URL 발견 (api.perplexity.ai) # 동일 업소 검증 — 두 소스 중 설정된 쪽을 쓴다(둘 다 있으면 카카오 우선). # 카카오: 15건 · 전화번호 O · 고유 place id O · 행정구역 코드 O → 판정 근거가 강하다 # 네이버: 5건 · 전화번호 X · 고유 id 불확실 · 행정구역 코드 X → 그만큼 AMBIGUOUS 가 늘어난다 kakao_rest_api_key: str = "" # dapi.kakao.com (미발급) naver_client_id: str = "" # openapi.naver.com 지역검색 naver_client_secret: str = "" gemini_api_key: str = "" # 사진 분류 + 카피 작성 (Google AI Studio) # 비전 모델. 사진 1장 ≈ 1,200 토큰이라 사업장 1건(50장)에 3.7-flash $0.045 / 2.5-flash $0.018. # 기본을 3.7 로 두는 이유: 라벨이 틀리면 사람 확인 큐 비용이 모델 값 차이보다 크다. gemini_vision_model: str = "gemini-3.7-flash" # 소개문·FAQ 생성 모델. 비전과 따로 둔다 — 텍스트는 토큰이 적어 상위 모델을 써도 싸다. gemini_text_model: str = "gemini-3.7-flash" # ★ 이 값 미만이면 자동 반영하지 않고 사람 확인 큐(PENDING_REVIEW)에 남긴다. 운영하며 조정한다. vision_confidence_threshold: float = 0.7 tour_api_key: str = "" # 공공데이터포털 일반 인증키(전국문화축제표준데이터)