Skip to content

Commit

Permalink
Revert change to alternate url
Browse files Browse the repository at this point in the history
  • Loading branch information
abarciauskas-bgse committed May 22, 2024
1 parent 456683f commit 001059c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions titiler/stacapi/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def _get_asset_info(self, asset: str) -> AssetInfo:
extras = asset_info.extra_fields

url = asset_info.get_absolute_href() or asset_info.href
if alternate := stac_config.alternate_url:
url = asset_info.to_dict()["alternate"][alternate]["href"]

# No caching of this should be necessary. From the docs https://planetarycomputer.microsoft.com/docs/concepts/sas/#planetary-computer-python-package:
# A cache is also kept, which tracks expiration values, to ensure new SAS tokens are only requested when needed.
# We only want to sign requests to MS PC API. Other ways to handle this could be:
Expand Down
2 changes: 2 additions & 0 deletions titiler/stacapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class STACAPISettings(BaseSettings):

class STACSettings(BaseSettings):
"""STAC API settings"""

alternate_url: Optional[str] = None

model_config = {
"env_prefix": "TITILER_STACAPI_",
Expand Down

0 comments on commit 001059c

Please sign in to comment.