5349f21752
New FastAPI microservice (port 8020) providing unified blob storage via PUT/GET/DELETE/LIST HTTP API. Local filesystem backend is the default (zero extra deps). S3-compatible and WebDAV backends are built in. Backend is switchable at runtime via POST /migrate, which copies all objects to the new backend, verifies each one, atomically switches, then cleans up the old backend. WebDAV XML parsing uses defusedxml to prevent XXE attacks. Wired into docker-compose (storage_data volume) and registered in the backend service-health poller as 'storage-service'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from pydantic import field_validator
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "destroying_sap"
|
|
|
|
DATABASE_URL: str = "postgresql+asyncpg://postgres:password@localhost:5432/destroying_sap"
|
|
|
|
# RS256 asymmetric signing — generate keys with scripts/generate_jwt_keys.py
|
|
ALGORITHM: str = "RS256"
|
|
JWT_PRIVATE_KEY: str = "" # PEM, required; set via env var
|
|
JWT_PUBLIC_KEY: str = "" # PEM, required; set via env var
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 8 # 8 hours — no permanent sessions
|
|
|
|
CORS_ORIGINS: list[str] = ["http://localhost:5173"]
|
|
|
|
DOC_SERVICE_URL: str = "http://doc-service:8001"
|
|
AI_SERVICE_URL: str = "http://ai-service:8010"
|
|
STORAGE_SERVICE_URL: str = "http://storage-service:8020"
|
|
|
|
@field_validator("JWT_PRIVATE_KEY", "JWT_PUBLIC_KEY", mode="before")
|
|
@classmethod
|
|
def expand_newlines(cls, v: str) -> str:
|
|
"""Allow PEM keys stored on a single line with literal \\n in .env."""
|
|
return v.replace("\\n", "\n") if isinstance(v, str) else v
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings()
|