diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ff0aff..b8a47ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: # STACK_ALARM_EMAIL: ${{ secrets.ALARM_EMAIL }} STACK_ROLE_ARN: ${{ secrets.lambda_role_arn }} STACK_STAGE: staging - STACK_ADDITIONAL_ENV: '{"TITILER_CMR_S3_AUTH_STRATEGY":"iam"}' + STACK_ADDITIONAL_ENV: '{"TITILER_CMR_S3_AUTH_STRATEGY":"iam", "TITILER_CMR_API_DEBUG": True}' # Build and deploy to production deployment whenever there a new tag is pushed - name: Build & Deploy Production diff --git a/titiler/cmr/backend.py b/titiler/cmr/backend.py index 5c77c27..4b595a4 100644 --- a/titiler/cmr/backend.py +++ b/titiler/cmr/backend.py @@ -1,6 +1,5 @@ """TiTiler.cmr custom Mosaic Backend.""" -import json from typing import Any, Dict, List, Optional, Tuple, Type, TypedDict import attr @@ -147,7 +146,7 @@ def assets_for_bbox( @cached( # type: ignore TTLCache(maxsize=cache_config.maxsize, ttl=cache_config.ttl), key=lambda self, xmin, ymin, xmax, ymax, **kwargs: hashkey( - self.input, str(xmin), str(ymin), str(xmax), str(ymax), json.dumps(kwargs) + self.input, xmin, ymin, xmax, ymax, **kwargs ), ) @retry( diff --git a/titiler/cmr/dependencies.py b/titiler/cmr/dependencies.py index 9f5495d..b9c7a14 100644 --- a/titiler/cmr/dependencies.py +++ b/titiler/cmr/dependencies.py @@ -106,6 +106,6 @@ def cmr_query( start = parse_rfc3339(dt[0]) if dt[0] not in ["..", ""] else None end = parse_rfc3339(dt[1]) if dt[1] not in ["..", ""] else None - query["temporal"] = [start, end] + query["temporal"] = (start, end) return query diff --git a/titiler/cmr/main.py b/titiler/cmr/main.py index 3d1d60a..86baca9 100644 --- a/titiler/cmr/main.py +++ b/titiler/cmr/main.py @@ -11,7 +11,7 @@ from titiler.cmr import __version__ as titiler_cmr_version from titiler.cmr.factory import Endpoints from titiler.cmr.settings import ApiSettings, AuthSettings -from titiler.core.middleware import CacheControlMiddleware +from titiler.core.middleware import CacheControlMiddleware, LoggerMiddleware jinja2_env = jinja2.Environment( loader=jinja2.ChoiceLoader( @@ -69,6 +69,9 @@ async def lifespan(app: FastAPI): app.add_middleware(CacheControlMiddleware, cachecontrol=settings.cachecontrol) +if settings.debug: + app.add_middleware(LoggerMiddleware, headers=True, querystrings=True) + ############################################################################### # application endpoints endpoints = Endpoints( diff --git a/titiler/cmr/settings.py b/titiler/cmr/settings.py index 11a18bf..0fe4868 100644 --- a/titiler/cmr/settings.py +++ b/titiler/cmr/settings.py @@ -14,6 +14,7 @@ class ApiSettings(BaseSettings): cors_origins: str = "*" cachecontrol: str = "public, max-age=3600" root_path: str = "" + debug: bool = False model_config = { "env_prefix": "TITILER_CMR_API_",