Skip to content

Commit 3286d1c

Browse files
committed
Add description to fastapi app
1 parent 1eece5a commit 3286d1c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

futuramaapi/apps/app.py

+9
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
from futuramaapi.middlewares.cors import CORSMiddleware
1717
from futuramaapi.middlewares.secure import HTTPSRedirectMiddleware
1818
from futuramaapi.repositories.session import session_manager
19+
from futuramaapi.utils._compat import metadata
1920

2021
if TYPE_CHECKING:
22+
from pydantic import HttpUrl
2123
from starlette.routing import Route, WebSocketRoute
2224

2325
mimetypes.add_type("image/webp", ".webp")
@@ -51,6 +53,12 @@ def _init_sentry() -> None:
5153
profiles_sample_rate=settings.sentry.profiles_sample_rate,
5254
)
5355

56+
@property
57+
def description(self):
58+
summary: str = metadata["summary"]
59+
project_url: HttpUrl = settings.build_url(is_static=False)
60+
return f"{summary} [Go back home]({project_url})."
61+
5462
@abstractmethod
5563
def get_app(
5664
self,
@@ -73,6 +81,7 @@ def get_app(
7381
redoc_url=None,
7482
lifespan=lifespan,
7583
version=self.version,
84+
description=self.description,
7685
)
7786

7887
def _add_middlewares(self) -> None:

0 commit comments

Comments
 (0)