POST /api/v1/search reading listings_search_mv with ~20 cross-source filters, parameterized SQL (CAST(:x AS type), psycopg v3), whitelisted ORDER BY (Pydantic Literal), Redis 5min hot cache with graceful degradation (singleton pool via lru_cache). Verified vs data/sql/050_search_optimization.sql: matview column refs (total_area, lng, house_rating, sources[], has_avito/cian/yandex), SQL injection safety, cache failure swallow, router prefix. Deep-code-reviewer: APPROVE.
36 lines
1.7 KiB
Python
36 lines
1.7 KiB
Python
"""Минимальный settings для standalone trade-in MVP."""
|
||
|
||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
||
|
||
class Settings(BaseSettings):
|
||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
||
|
||
# required — задаётся через env DATABASE_URL. Нет дефолта: fail-fast при старте
|
||
# если переменная не задана (C-3 security audit).
|
||
database_url: str
|
||
cors_origins: list[str] = ["http://localhost", "http://localhost:3000", "http://localhost:8080"]
|
||
environment: str = "dev"
|
||
|
||
# Geocoder
|
||
yandex_geocoder_key: str | None = None # 25K req/day free после регистрации
|
||
yandex_suggest_key: str | None = None # для frontend autocomplete (proxy через backend)
|
||
# для User-Agent в Nominatim (Nominatim Usage Policy)
|
||
contact_email: str = "erginrajpopxbe@outlook.com"
|
||
|
||
# Public URL — для QR-кода в PDF, shareable links, etc.
|
||
public_url: str = "http://127.0.0.1:8080"
|
||
|
||
# GlitchTip DSN — мониторинг ошибок (Sentry-совместимый). #396.
|
||
# Пусто = мониторинг выключен (dev). В prod — env GLITCHTIP_DSN из .env.runtime.
|
||
glitchtip_dsn: str | None = None
|
||
|
||
# Ключ шифрования для pgp_sym_encrypt (Cian session cookies).
|
||
# Задаётся через env COOKIE_ENCRYPTION_KEY. Пусто = шифрование не работает.
|
||
cookie_encryption_key: str = ""
|
||
|
||
# Redis URL для hot-cache (Phase 3.2). Задаётся через env REDIS_URL.
|
||
redis_url: str = "redis://localhost:6379/0"
|
||
|
||
|
||
settings = Settings()
|