openreplay/api/boot/middleware/cors.py

15 lines
470 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from boot.config import settings
def setup_cors(app: FastAPI) -> None:
"""Configure CORS middleware for the application."""
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ORIGINS,
allow_credentials=settings.CORS_ALLOW_CREDENTIALS,
allow_methods=settings.CORS_ALLOW_METHODS,
allow_headers=settings.CORS_ALLOW_HEADERS,
)