Files
breakpilot-compliance/dsms-gateway/main.py
Sharang Parnerkar a7fe32fb82 refactor(consent-sdk,dsms-gateway): split ConsentManager, types, and main.py
- consent-sdk/src/types/index.ts: extracted 438 LOC into core.ts, config.ts,
  vendor.ts, api.ts, events.ts, storage.ts, translations.ts; index.ts is now
  a 21-LOC barrel re-exporter
- consent-sdk/src/core/ConsentManager.ts: extracted normalizeConsentInput,
  isConsentExpired, needsConsent, ALL_CATEGORIES, MINIMAL_CATEGORIES into
  consent-manager-helpers.ts; reduced from 467 to 345 LOC
- dsms-gateway/main.py: extracted models → models.py, config → config.py,
  IPFS helpers + verify_token → dependencies.py, route handlers →
  routers/documents.py and routers/node.py; main.py is now a 41-LOC app
  factory; test mock paths updated accordingly (27/27 tests pass)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 08:42:32 +02:00

42 lines
1.1 KiB
Python

"""
DSMS Gateway - REST API für dezentrales Speichersystem
Bietet eine vereinfachte API über IPFS für BreakPilot
"""
import sys
import os
# Ensure the gateway directory itself is on the path so routers can use flat imports.
sys.path.insert(0, os.path.dirname(__file__))
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from models import DocumentMetadata, StoredDocument, DocumentList # noqa: F401 — re-exported for tests
from routers.documents import router as documents_router
from routers.node import router as node_router
app = FastAPI(
title="DSMS Gateway",
description="Dezentrales Daten Speicher System Gateway für BreakPilot",
version="1.0.0"
)
# CORS Configuration
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:8000", "http://backend:8000", "*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Router registration
app.include_router(node_router)
app.include_router(documents_router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8082)