Skip to content

Commit 025a680

Browse files
committed
add configurable api title and description
1 parent 4b20128 commit 025a680

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cads_processing_api_service/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131

3232
logger: structlog.stdlib.BoundLogger = structlog.get_logger(__name__)
3333

34+
API_TITLE = "CADS Processing API"
35+
API_DESCRIPTION = (
36+
"This REST API service enables the submission of processing tasks (data retrieval) to the "
37+
"CADS system, and their consequent monitoring and management. "
38+
"The service is based on the [OGC API - Processes standard](https://ogcapi.ogc.org/processes/)."
39+
)
40+
3441
API_REQUEST_TEMPLATE = """import cdsapi
3542
3643
dataset = "{process_id}"
@@ -189,6 +196,9 @@ def profiles_api_url(self) -> str:
189196
cache_resources_maxsize: int = 1000
190197
cache_resources_ttl: int = 10
191198

199+
api_title: str = API_TITLE
200+
api_description: str = API_DESCRIPTION
201+
192202
api_request_template: str = API_REQUEST_TEMPLATE
193203
api_request_max_list_length: dict[str, int] = API_REQUEST_MAX_LIST_LENGTH
194204
missing_dataset_title: str = "Dataset not available"

cads_processing_api_service/main.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,12 @@ async def lifespan(application: fastapi.FastAPI) -> AsyncGenerator[Any, None]:
6868

6969
logger = structlog.get_logger(__name__)
7070

71+
7172
app = ogc_api_processes_fastapi.instantiate_app(
7273
client=clients.DatabaseClient(), # type: ignore
7374
exception_handler=exceptions.exception_handler,
74-
title="CADS Processing API",
75-
description=(
76-
"This is a FastAPI-based implementation of the "
77-
"[OGC API - Processes standard](https://ogcapi.ogc.org/processes/)."
78-
),
75+
title=SETTINGS.api_title,
76+
description=SETTINGS.api_description,
7977
)
8078
app = exceptions.include_exception_handlers(app)
8179
# FIXME : "app.router.lifespan_context" is not officially supported and would likely break

0 commit comments

Comments
 (0)