get_ssl_context_kwargs

View as MarkdownOpen in Claude

Get SSL parameters suitable for passing to uvicorn’s ssl_certfile and ssl_keyfile arguments.

Returns

dict[str, Any] — A dictionary with ssl_certfile and ssl_keyfile keys when SSL is enabled and valid. Returns an empty dict when SSL is disabled.

Example

import uvicorn
from fastapi import FastAPI
from signalwire.core.security_config import SecurityConfig
security = SecurityConfig()
ssl_kwargs = security.get_ssl_context_kwargs()
app = FastAPI()
uvicorn.run(app, host="0.0.0.0", port=443, **ssl_kwargs)