From 66d8d2bb8c22f3f094f81eddf2b6f2f4589eb26d Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:39:32 -0700 Subject: [PATCH 1/5] fix: update stac_api_url and raster_api_url properties to default to using apigw --- ingest_api/infrastructure/config.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index d8277013..7dbac4ad 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -105,15 +105,17 @@ def env(self) -> aws_cdk.Environment: ) @property - 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: + def veda_stac_api_url(self) -> str: + if self.stac_api_url is not None: + return self.stac_api_url + elif self.custom_host and self.stac_root_path: return f"https://{self.custom_host}{self.stac_root_path}" - return self.stac_api_url + raise ValueError("No valid STAC API URL available.") @property - 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: + def veda_raster_api_url(self) -> str: + if self.raster_api_url: + return self.raster_api_url + elif self.custom_host and self.raster_root_path: return f"https://{self.custom_host}{self.raster_root_path}" - return self.raster_api_url + raise ValueError("No valid raster API URL available.") From 343bf54d603c34123d7132635af3795defdf55a2 Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:12:25 -0700 Subject: [PATCH 2/5] fix: lambda env config --- ingest_api/infrastructure/construct.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index d7dcd05f..a7527587 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -256,11 +256,11 @@ def __init__( lambda_env = { "DYNAMODB_TABLE": table.table_name, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.veda_stac_api_cf_url, + "STAC_URL": config.veda_stac_api_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.veda_raster_api_cf_url, + "RASTER_URL": config.veda_raster_api_url, } if config.raster_data_access_role_arn: From 183bdd0c1a49aef541fc3760d667704113218d8f Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:10:54 -0700 Subject: [PATCH 3/5] fix: update variable names --- ingest_api/infrastructure/construct.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index a7527587..0d4bde57 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -45,11 +45,11 @@ def __init__( "DYNAMODB_TABLE": self.table.table_name, "JWKS_URL": self.jwks_url, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.veda_stac_api_cf_url, + "STAC_URL": config.veda_stac_api_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.veda_raster_api_cf_url, + "RASTER_URL": config.veda_raster_api_url, "ROOT_PATH": config.ingest_root_path, "STAGE": config.stage, "COGNITO_DOMAIN": config.cognito_domain, From 6b7f75ad12c6dd72687f32225ee7eff404a34d8b Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:46:33 -0700 Subject: [PATCH 4/5] fix: remove stac and raster cloudfront url properties altogether --- ingest_api/infrastructure/config.py | 16 ---------------- ingest_api/infrastructure/construct.py | 8 ++++---- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index 7dbac4ad..2064d5da 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -103,19 +103,3 @@ def env(self) -> aws_cdk.Environment: account=self.aws_account, region=self.aws_region, ) - - @property - def veda_stac_api_url(self) -> str: - if self.stac_api_url is not None: - return self.stac_api_url - elif self.custom_host and self.stac_root_path: - return f"https://{self.custom_host}{self.stac_root_path}" - raise ValueError("No valid STAC API URL available.") - - @property - def veda_raster_api_url(self) -> str: - if self.raster_api_url: - return self.raster_api_url - elif self.custom_host and self.raster_root_path: - return f"https://{self.custom_host}{self.raster_root_path}" - raise ValueError("No valid raster API URL available.") diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index 0d4bde57..bedf990b 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -45,11 +45,11 @@ def __init__( "DYNAMODB_TABLE": self.table.table_name, "JWKS_URL": self.jwks_url, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.veda_stac_api_url, + "STAC_URL": config.stac_api_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.veda_raster_api_url, + "RASTER_URL": config.raster_api_url, "ROOT_PATH": config.ingest_root_path, "STAGE": config.stage, "COGNITO_DOMAIN": config.cognito_domain, @@ -256,11 +256,11 @@ def __init__( lambda_env = { "DYNAMODB_TABLE": table.table_name, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.veda_stac_api_url, + "STAC_URL": config.stac_api_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.veda_raster_api_url, + "RASTER_URL": config.raster_api_url, } if config.raster_data_access_role_arn: From 8ebddec61f0a812f7d628ea007776d3e089963d7 Mon Sep 17 00:00:00 2001 From: Jennifer Tran <12633533+botanical@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:02:35 -0700 Subject: [PATCH 5/5] fix: update condition in veda_raster_api_cf_url to check for raster_root_path and update config vars in ingest-api --- ingest_api/infrastructure/config.py | 14 ++++++++++++++ ingest_api/infrastructure/construct.py | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index 2064d5da..31a894bb 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -103,3 +103,17 @@ def env(self) -> aws_cdk.Environment: account=self.aws_account, region=self.aws_region, ) + + @property + 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 self.stac_api_url + + @property + 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.raster_root_path: + return f"https://{self.custom_host}{self.raster_root_path}" + return self.raster_api_url diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index bedf990b..d7dcd05f 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -45,11 +45,11 @@ def __init__( "DYNAMODB_TABLE": self.table.table_name, "JWKS_URL": self.jwks_url, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.stac_api_url, + "STAC_URL": config.veda_stac_api_cf_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.raster_api_url, + "RASTER_URL": config.veda_raster_api_cf_url, "ROOT_PATH": config.ingest_root_path, "STAGE": config.stage, "COGNITO_DOMAIN": config.cognito_domain, @@ -256,11 +256,11 @@ def __init__( lambda_env = { "DYNAMODB_TABLE": table.table_name, "NO_PYDANTIC_SSM_SETTINGS": "1", - "STAC_URL": config.stac_api_url, + "STAC_URL": config.veda_stac_api_cf_url, "USERPOOL_ID": config.userpool_id, "CLIENT_ID": config.client_id, "CLIENT_SECRET": config.client_secret, - "RASTER_URL": config.raster_api_url, + "RASTER_URL": config.veda_raster_api_cf_url, } if config.raster_data_access_role_arn: