|
7 | 7 | import morecantile |
8 | 8 | import rasterio |
9 | 9 | from fastapi import FastAPI, Query |
| 10 | +from fastapi import __version__ as fastapi_version |
10 | 11 | from fastapi.responses import ORJSONResponse |
11 | 12 | from morecantile import TileMatrixSets |
| 13 | +from pydantic import __version__ as pydantic_version |
| 14 | +from rio_tiler import __version__ as rio_tiler_version |
| 15 | +from starlette import __version__ as starlette_version |
12 | 16 | from starlette.middleware.cors import CORSMiddleware |
13 | 17 | from starlette.requests import Request |
14 | 18 | from starlette.templating import Jinja2Templates |
@@ -375,57 +379,30 @@ def conformance( |
375 | 379 | ############################################################################### |
376 | 380 | # Health Check Endpoint |
377 | 381 | @app.get("/healthz", description="Health Check", tags=["Health Check"]) |
378 | | -def ping() -> dict: |
| 382 | +def ping(request: Request) -> dict: |
379 | 383 | """Health check.""" |
380 | 384 | try: |
381 | 385 | resp = httpx.get(app.state.stac_url) |
382 | 386 | api_online = True if resp.status_code == 200 else False |
383 | 387 | except: # noqa |
384 | 388 | api_online = False |
385 | 389 |
|
386 | | - return { |
| 390 | + data = { |
387 | 391 | "stac-api_online": api_online, |
388 | 392 | "versions": { |
389 | 393 | "titiler": titiler_version, |
390 | 394 | "titiler.stacapi": titiler_stacapi_version, |
391 | 395 | "rasterio": rasterio.__version__, |
| 396 | + "rio-tiler": rio_tiler_version, |
392 | 397 | "gdal": rasterio.__gdal_version__, |
393 | 398 | "proj": rasterio.__proj_version__, |
394 | | - "geos": rasterio.__geos_version__, |
| 399 | + "fastapi": fastapi_version, |
| 400 | + "starlette": starlette_version, |
| 401 | + "pydantic": pydantic_version, |
395 | 402 | }, |
396 | 403 | } |
397 | 404 |
|
| 405 | + if settings.debug: |
| 406 | + data["url"] = request.app.state.stac_url |
398 | 407 |
|
399 | | -if settings.debug: |
400 | | - |
401 | | - @app.get("/debug", include_in_schema=False, tags=["DEBUG"]) |
402 | | - def debug(request: Request) -> dict: |
403 | | - """APP Info.""" |
404 | | - |
405 | | - import rasterio |
406 | | - from fastapi import __version__ as fastapi_version |
407 | | - from pydantic import __version__ as pydantic_version |
408 | | - from rio_tiler import __version__ as rio_tiler_version |
409 | | - from starlette import __version__ as starlette_version |
410 | | - |
411 | | - try: |
412 | | - resp = httpx.get(app.state.stac_url) |
413 | | - api_online = True if resp.status_code == 200 else False |
414 | | - except: # noqa |
415 | | - api_online = False |
416 | | - |
417 | | - return { |
418 | | - "url": request.app.state.stac_url, |
419 | | - "stac-api_online": api_online, |
420 | | - "versions": { |
421 | | - "titiler.stacapi": titiler_stacapi_version, |
422 | | - "titiler.core": titiler_version, |
423 | | - "rio-tiler": rio_tiler_version, |
424 | | - "rasterio": rasterio.__version__, |
425 | | - "gdal": rasterio.__gdal_version__, |
426 | | - "proj": rasterio.__proj_version__, |
427 | | - "fastapi": fastapi_version, |
428 | | - "starlette": starlette_version, |
429 | | - "pydantic": pydantic_version, |
430 | | - }, |
431 | | - } |
| 408 | + return data |
0 commit comments