Skip to content

Commit

Permalink
fix: update domain names to support multiple domain names for prod (#418
Browse files Browse the repository at this point in the history
)
  • Loading branch information
botanical authored Aug 15, 2024
1 parent 96a336f commit e6f66d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions routes/infrastructure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ class vedaRouteSettings(BaseSettings):
None, description="Shared Web ACL ID ARN for CloudFront Distribution"
)

custom_host: str = Field(
None,
description="Complete url of custom host including subdomain. Used to infer url of stac-api before app synthesis.",
)

class Config:
"""model config"""

Expand Down
20 changes: 14 additions & 6 deletions routes/infrastructure/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ def __init__(
description="Origin Access Control for STAC Browser",
),
)
if (
veda_route_settings.domain_hosted_zone_name
== veda_route_settings.custom_host
):
self.cf_domain_names = [
f"{stage}.{veda_route_settings.domain_hosted_zone_name}",
f"{veda_route_settings.domain_hosted_zone_name}",
]
else:
self.cf_domain_names = [
f"{stage}.{veda_route_settings.domain_hosted_zone_name}"
]

self.distribution = cf.Distribution(
self,
Expand All @@ -73,9 +85,7 @@ def __init__(
default_root_object="index.html",
enable_logging=True,
web_acl_id=veda_route_settings.shared_web_acl_id,
domain_names=[
f"{stage}.{veda_route_settings.domain_hosted_zone_name}"
]
domain_names=self.cf_domain_names
if veda_route_settings.domain_hosted_zone_name
else None,
)
Expand Down Expand Up @@ -112,9 +122,7 @@ def __init__(
certificate=domain_cert,
default_root_object="index.html",
enable_logging=True,
domain_names=[
f"{stage}.{veda_route_settings.domain_hosted_zone_name}"
]
domain_names=self.cf_domain_names
if veda_route_settings.domain_hosted_zone_name
else None,
)
Expand Down

0 comments on commit e6f66d8

Please sign in to comment.