Add support for running the server with SSL (#994)
This commit is contained in:
parent
ef22e478db
commit
8e44a32075
2 changed files with 9 additions and 1 deletions
|
@ -96,5 +96,6 @@ if __name__ == "__main__":
|
||||||
app = create_app(settings=settings)
|
app = create_app(settings=settings)
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
app, host=os.getenv("HOST", settings.host), port=int(os.getenv("PORT", settings.port))
|
app, host=os.getenv("HOST", settings.host), port=int(os.getenv("PORT", settings.port)),
|
||||||
|
ssl_keyfile=settings.ssl_keyfile, ssl_certfile=settings.ssl_certfile
|
||||||
)
|
)
|
||||||
|
|
|
@ -150,6 +150,13 @@ class Settings(BaseSettings):
|
||||||
# Server Params
|
# Server Params
|
||||||
host: str = Field(default="localhost", description="Listen address")
|
host: str = Field(default="localhost", description="Listen address")
|
||||||
port: int = Field(default=8000, description="Listen port")
|
port: int = Field(default=8000, description="Listen port")
|
||||||
|
# SSL Params
|
||||||
|
ssl_keyfile: Optional[str] = Field(
|
||||||
|
default=None, description="SSL key file for HTTPS"
|
||||||
|
)
|
||||||
|
ssl_certfile: Optional[str] = Field(
|
||||||
|
default=None, description="SSL certificate file for HTTPS"
|
||||||
|
)
|
||||||
interrupt_requests: bool = Field(
|
interrupt_requests: bool = Field(
|
||||||
default=True,
|
default=True,
|
||||||
description="Whether to interrupt requests when a new request is received.",
|
description="Whether to interrupt requests when a new request is received.",
|
||||||
|
|
Loading…
Reference in a new issue