INNER CODE UNIT · Python
CodeGateServer
stacklok/codegate · src/codegate/server.py:37
class CodeGateServer(FastAPI):
provider_registry: ProviderRegistry = None
def set_provider_registry(self, registry: ProviderRegistry):
self.provider_registry = registry
def init_app(pipeline_factory: PipelineFactory) -> CodeGateServer:
"""Create the FastAPI application."""
app = CodeGateServer(
title="CodeGate",
description=__description__,
version=__version__,
)
@app.middleware("http")
async def log_user_agent(request: Request, call_next):
user_agent = request.headers.get("user-agent")