Skip to content

Commit

Permalink
fix: fall back to using api gateway url
Browse files Browse the repository at this point in the history
  • Loading branch information
botanical committed Aug 23, 2024
1 parent d5d307f commit 8735f45
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
ingestor_config = ingest_config(
stage=veda_app_settings.stage_name(),
stac_db_security_group_id=db_security_group.security_group_id,
stac_api_url=stac_api.stac_api.url,
raster_api_url=raster_api.raster_api.url,
)

ingest_api = ingest_api_construct(
Expand Down
22 changes: 15 additions & 7 deletions ingest_api/infrastructure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,25 @@ class IngestorConfig(BaseSettings):
description="Version of PgStac database, i.e. 0.5",
)

custom_host: str = Field(
stac_api_url: str = Field(
description="URL of STAC API Gateway endpoint used to serve STAC Items"
)

raster_api_url: str = Field(
description="URL of Raster API Gateway endpoing used to serve asset tiles"
)

custom_host: Optional[str] = Field(
None,
description="Complete url of custom host including subdomain. Used to infer url of apis before app synthesis.",
)

stac_root_path: str = Field(
stac_root_path: Optional[str] = Field(
"",
description="STAC API root path. Used to infer url of stac-api before app synthesis.",
)

raster_root_path: str = Field(
raster_root_path: Optional[str] = Field(
"",
description="Raster API root path. Used to infer url of raster-api before app synthesis.",
)
Expand All @@ -97,15 +105,15 @@ def env(self) -> aws_cdk.Environment:
)

@property
def veda_stac_api_cf_url(self) -> Optional[str]:
def veda_stac_api_cf_url(self) -> str:
"""inferred cloudfront url of the stac api if app is configured with a custom host and root path"""
if self.custom_host and self.stac_root_path:
return f"https://{self.custom_host}{self.stac_root_path}"
return None
return self.stac_api_url

@property
def veda_raster_api_cf_url(self) -> Optional[str]:
def veda_raster_api_cf_url(self) -> str:
"""inferred cloudfront url of the raster api if app is configured with a custom host and root path"""
if self.custom_host and self.stac_root_path:
return f"https://{self.custom_host}{self.raster_root_path}"
return None
return self.raster_api_url

0 comments on commit 8735f45

Please sign in to comment.