- Adopt PEP 517/518 src-layout for api package using hatchling and uv. - Configure dependencies: FastAPI, async SQLAlchemy 2.0, GeoAlchemy2, pgvector, and Pydantic v2. - Implement decoupled SSO Identity Provider protocol with MockDevAdapter, GoogleOAuthAdapter, and AuthService. - Define PostGIS and pgvector SQLAlchemy database models in api/db_models/. - Implement pure-logic Consensus Engine with Haversine distance, Velocity Checks, and cluster confidence scoring. - Add test suite in api/tests/ with 18 unit/integration tests and configure Ruff and Pyright quality gates.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""
|
|
Application configuration loaded from environment variables.
|
|
"""
|
|
|
|
ENV: str = "development"
|
|
PROJECT_NAME: str = "Novias del Gato API"
|
|
VERSION: str = "0.1.0"
|
|
|
|
# Database
|
|
DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/novias_db"
|
|
|
|
# JWT
|
|
JWT_SECRET: str = "insecure_dev_secret_change_in_production"
|
|
JWT_ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440
|
|
|
|
# OAuth / SSO
|
|
GOOGLE_CLIENT_ID: str | None = None
|
|
GOOGLE_CLIENT_SECRET: str | None = None
|
|
GOOGLE_REDIRECT_URI: str | None = None
|
|
|
|
# Recognition and Spatial Rules
|
|
SIMILARITY_THRESHOLD: float = 0.65
|
|
PROXIMITY_RADIUS_METERS: float = 15.0
|
|
|
|
# Consensus Engine Thresholds
|
|
CONSENSUS_CLUSTER_RADIUS_METERS: float = 20.0
|
|
CONSENSUS_CONFIDENCE_THRESHOLD: float = 3.0
|
|
CONSENSUS_MIN_REPORTERS: int = 3
|
|
MAX_PLAUSIBLE_VELOCITY_KMH: float = 120.0
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
|
|
settings = Settings()
|