Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Feb 1, 2024
1 parent 48492fc commit 9214426
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions titiler/cmr/backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""TiTiler.cmr custom Mosaic Backend."""

import json
from typing import Any, Dict, List, Optional, Tuple, Type, TypedDict

import attr
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion titiler/cmr/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion titiler/cmr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions titiler/cmr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_",
Expand Down

0 comments on commit 9214426

Please sign in to comment.