Skip to content

Commit e507234

Browse files
committed
create a settings class for browser, remove browser demo config and add example instead
1 parent a4bfad4 commit e507234

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

infrastructure/aws/cdk/app.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
eoAPISettings,
1717
eoDBSettings,
1818
eoRasterSettings,
19+
eoStacBrowserSettings,
1920
eoSTACSettings,
2021
eoVectorSettings,
2122
)
@@ -242,10 +243,9 @@ def __init__( # noqa: C901
242243
},
243244
)
244245

245-
if eostac_settings.stac_api_custom_domain_name is not None:
246-
assert (
247-
eostac_settings.stac_browser_github_tag is not None
248-
), "stac_browser_github_tag must be set if stac_api_custom_domain_name is not None."
246+
if "browser" in eoapi_settings.functions:
247+
eobrowser_settings = eoStacBrowserSettings()
248+
249249
stac_browser_bucket = s3.Bucket(
250250
self,
251251
"stac-browser-bucket",
@@ -268,11 +268,11 @@ def __init__( # noqa: C901
268268
StacBrowser(
269269
self,
270270
"stac-browser",
271-
github_repo_tag=eostac_settings.stac_browser_github_tag,
272-
stac_catalog_url=eostac_settings.stac_api_custom_domain_name,
271+
github_repo_tag=eobrowser_settings.stac_browser_github_tag,
272+
stac_catalog_url=eobrowser_settings.stac_catalog_url,
273273
website_index_document="index.html",
274274
bucket_arn=stac_browser_bucket.bucket_arn,
275-
config_file_path="cdk/stac_browser_config.js",
275+
config_file_path=eobrowser_settings.config_file_path,
276276
)
277277

278278
# eoapi.vector

infrastructure/aws/cdk/stac_browser_config.js renamed to infrastructure/aws/cdk/browser_config.example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
apiCatalogPriority: null,
1919
useTileLayerAsFallback: true,
2020
displayGeoTiffByDefault: false,
21-
buildTileUrlTemplate: ({href, asset}) => "https://raster.eoapi.dev/cog/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(asset.href.startsWith("/vsi") ? asset.href : href),
21+
buildTileUrlTemplate: ({href, asset}) => "https://raster.dev/cog/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(asset.href.startsWith("/vsi") ? asset.href : href),
2222
stacProxyUrl: null,
2323
pathPrefix: "/",
2424
historyMode: "history",

infrastructure/aws/cdk/config.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class functionName(str, Enum):
1313
raster = "raster"
1414
vector = "vector"
1515
ingestor = "ingestor"
16+
browser = "browser" # not actually a function, but this keeps things clean.
1617

1718

1819
class eoAPISettings(BaseSettings):
@@ -57,10 +58,6 @@ class eoSTACSettings(BaseSettings):
5758

5859
timeout: int = 10
5960
memory: int = 256
60-
stac_browser_github_tag: None | str = "v3.1.0"
61-
stac_api_custom_domain_name: None | str = (
62-
None # if not none, will try to deploy a browser with the above tag
63-
)
6461
model_config = {
6562
"env_prefix": "CDK_EOAPI_STAC_",
6663
"env_file": ".env",
@@ -115,3 +112,15 @@ class eoVectorSettings(BaseSettings):
115112
"env_prefix": "CDK_EOAPI_VECTOR_",
116113
"env_file": ".env",
117114
}
115+
116+
117+
class eoStacBrowserSettings(BaseSettings):
118+
"""STAC browser settings"""
119+
120+
stac_browser_github_tag: None | str = "v3.1.0"
121+
stac_catalog_url: None | str = None
122+
config_file_path: None | str = None
123+
model_config = {
124+
"env_prefix": "CDK_EOAPI_BROWSER_",
125+
"env_file": ".env",
126+
}

0 commit comments

Comments
 (0)