Skip to content

Commit

Permalink
refactor(server): get eodag version
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Feb 9, 2024
1 parent 1aff1d9 commit 45d9fab
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions eodag/rest/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
# limitations under the License.
from __future__ import annotations

import io
import logging
import os
import traceback
from contextlib import asynccontextmanager
from distutils import dist
from importlib.metadata import version
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -35,7 +34,6 @@
Union,
)

import pkg_resources
from fastapi import APIRouter as FastAPIRouter
from fastapi import FastAPI, HTTPException, Request
from fastapi.encoders import jsonable_encoder
Expand Down Expand Up @@ -136,18 +134,12 @@ def eodag_openapi() -> Dict[str, Any]:
if app.openapi_schema:
return app.openapi_schema

# eodag metadata
distribution = pkg_resources.get_distribution("eodag")
metadata_str = distribution.get_metadata(distribution.PKG_INFO)
metadata_obj = dist.DistributionMetadata()
metadata_obj.read_pkg_file(io.StringIO(metadata_str))

root_catalog = get_stac_catalogs(url="", fetch_providers=False)
stac_api_version = get_stac_api_version()

openapi_schema = get_openapi(
title=f"{root_catalog['title']} / eodag",
version=getattr(metadata_obj, "version", None),
version=version("eodag"),
routes=app.routes,
)

Expand Down

0 comments on commit 45d9fab

Please sign in to comment.