Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[None]:


app = FastAPI(
root_path=configuration.service_configuration.root_path,
title=f"{service_name} service - OpenAPI",
summary=f"{service_name} service API specification.",
description=f"{service_name} service API specification.",
Expand Down
3 changes: 1 addition & 2 deletions src/runners/uvicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def start_uvicorn(configuration: ServiceConfiguration) -> None:

Parameters:
configuration (ServiceConfiguration): Configuration providing host,
port, workers, `root_path`, and `tls_config` (including `tls_key_path`,
port, workers, and `tls_config` (including `tls_key_path`,
`tls_certificate_path`, and `tls_key_password`). TLS fields may be None
and will be forwarded to uvicorn.run as provided.
"""
Expand All @@ -31,7 +31,6 @@ def start_uvicorn(configuration: ServiceConfiguration) -> None:
host=configuration.host,
port=configuration.port,
workers=configuration.workers,
root_path=configuration.root_path,
log_level=log_level,
ssl_keyfile=configuration.tls_config.tls_key_path,
ssl_certfile=configuration.tls_config.tls_certificate_path,
Expand Down
7 changes: 1 addition & 6 deletions tests/unit/runners/test_uvicorn_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def test_start_uvicorn(mocker: MockerFixture) -> None:
host="localhost",
port=8080,
workers=1,
root_path="",
log_level=20,
ssl_certfile=None,
ssl_keyfile=None,
Expand All @@ -46,7 +45,6 @@ def test_start_uvicorn_different_host_port(mocker: MockerFixture) -> None:
host="x.y.com",
port=1234,
workers=10,
root_path="",
log_level=20,
ssl_certfile=None,
ssl_keyfile=None,
Expand All @@ -71,7 +69,6 @@ def test_start_uvicorn_empty_tls_configuration(mocker: MockerFixture) -> None:
host="x.y.com",
port=1234,
workers=10,
root_path="",
log_level=20,
ssl_certfile=None,
ssl_keyfile=None,
Expand Down Expand Up @@ -100,7 +97,6 @@ def test_start_uvicorn_tls_configuration(mocker: MockerFixture) -> None:
host="x.y.com",
port=1234,
workers=10,
root_path="",
log_level=20,
ssl_certfile=Path("tests/configuration/server.crt"),
ssl_keyfile=Path("tests/configuration/server.key"),
Expand All @@ -111,7 +107,7 @@ def test_start_uvicorn_tls_configuration(mocker: MockerFixture) -> None:


def test_start_uvicorn_with_root_path(mocker: MockerFixture) -> None:
"""Test the function to start Uvicorn server with a custom root path."""
"""Test that root_path is not passed to uvicorn (it belongs on the FastAPI constructor)."""
configuration = ServiceConfiguration(
host="localhost", port=8080, workers=1, root_path="/api/lightspeed"
) # pyright: ignore[reportCallIssue]
Expand All @@ -124,7 +120,6 @@ def test_start_uvicorn_with_root_path(mocker: MockerFixture) -> None:
host="localhost",
port=8080,
workers=1,
root_path="/api/lightspeed",
log_level=20,
ssl_certfile=None,
ssl_keyfile=None,
Expand Down
Loading