Updated this to the latest version of develop, got rid of most of the duplication, might be missing some packages in toml, needs testing

This commit is contained in:
Carlos Mesquita
2024-08-30 02:35:11 +01:00
parent 3cf9fa5cba
commit f92a803d96
73 changed files with 3642 additions and 2703 deletions

View File

@@ -116,6 +116,16 @@ def setup_listeners(_app: FastAPI) -> None:
content={"error_code": exc.error_code, "message": exc.message},
)
@_app.exception_handler(Exception)
async def default_exception_handler(request: Request, exc: Exception):
"""
Don't delete request param
"""
return JSONResponse(
status_code=500,
content=str(exc),
)
def setup_middleware() -> List[Middleware]:
middleware = [
@@ -135,9 +145,10 @@ def setup_middleware() -> List[Middleware]:
def create_app() -> FastAPI:
env = os.getenv("ENV")
_app = FastAPI(
docs_url=None,
redoc_url=None,
docs_url="/docs" if env != "prod" else None,
redoc_url="/redoc" if env != "prod" else None,
middleware=setup_middleware(),
lifespan=lifespan
)