Skip to content

Commit

Permalink
fix: update stac and raster api title and description (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
smohiudd authored May 31, 2024
2 parents c55e375 + aa431f8 commit 5a559f6
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ CDK_DEFAULT_REGION=[REQUIRED IF DEPLOYING TO EXISTING VPC]

STAGE=[FILL ME IN]

VEDA_PROJECT_NAME=
VEDA_PROJECT_DESCRIPTION=

VEDA_DB_PGSTAC_VERSION=0.6.6
VEDA_DB_SCHEMA_VERSION=0.1.0
VEDA_DB_SNAPSHOT_ID=[OPTIONAL BUT **REQUIRED** FOR ALL DEPLOYMENTS AFTER BASING DEPLOYMENT ON SNAPSHOT]
Expand Down
6 changes: 6 additions & 0 deletions raster_api/infrastructure/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Settings for Raster API - any environment variables starting with
`VEDA_RASTER_` will overwrite the values of variables in this file
"""

from typing import Dict, List, Optional

from pydantic import BaseSettings, Field
Expand Down Expand Up @@ -79,6 +80,11 @@ class vedaRasterSettings(BaseSettings):
description="Complete url of custom host including subdomain. When provided, override host in api integration",
)

project_name: Optional[str] = Field(
"VEDA (Visualization, Exploration, and Data Analysis)",
description="Name of the STAC Catalog",
)

class Config:
"""model config"""

Expand Down
22 changes: 10 additions & 12 deletions raster_api/infrastructure/construct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CDK Constrcut for a Lambda based TiTiler API with pgstac extension."""

import os
import typing
from typing import Optional
Expand Down Expand Up @@ -58,7 +59,15 @@ def __init__(
memory_size=veda_raster_settings.memory,
timeout=Duration.seconds(veda_raster_settings.timeout),
log_retention=aws_logs.RetentionDays.ONE_WEEK,
environment=veda_raster_settings.env or {},
environment={
**veda_raster_settings.env,
"VEDA_RASTER_ENABLE_MOSAIC_SEARCH": str(
veda_raster_settings.raster_enable_mosaic_search
),
"VEDA_RASTER_ROOT_PATH": veda_raster_settings.raster_root_path,
"VEDA_RASTER_STAGE": stage,
"VEDA_RASTER_PROJECT_NAME": veda_raster_settings.project_name,
},
tracing=aws_lambda.Tracing.ACTIVE,
)

Expand All @@ -67,21 +76,10 @@ def __init__(
veda_raster_function, port_range=aws_ec2.Port.tcp(5432)
)

veda_raster_function.add_environment(
"VEDA_RASTER_ENABLE_MOSAIC_SEARCH",
str(veda_raster_settings.raster_enable_mosaic_search),
)

veda_raster_function.add_environment(
"VEDA_RASTER_PGSTAC_SECRET_ARN", database.pgstac.secret.secret_full_arn
)

veda_raster_function.add_environment(
"VEDA_RASTER_ROOT_PATH", veda_raster_settings.raster_root_path
)

veda_raster_function.add_environment("VEDA_RASTER_STAGE", stage)

# Optional AWS S3 requester pays global setting
if veda_raster_settings.raster_aws_request_payer:
veda_raster_function.add_environment(
Expand Down
2 changes: 1 addition & 1 deletion raster_api/runtime/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def lifespan(app: FastAPI):


app = FastAPI(
title=settings.name,
title=f"{settings.project_name} Raster API",
version=veda_raster_version,
openapi_url="/openapi.json",
docs_url="/docs",
Expand Down
4 changes: 2 additions & 2 deletions raster_api/runtime/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def get_role_credentials(role_arn: str):
class ApiSettings(BaseSettings):
"""API settings"""

name: str = "veda-raster"
project_name: str = "veda"
cors_origins: str = "*"
cachecontrol: str = "public, max-age=3600"
cachecontrol: str = "max-age=30,must-revalidate,s-maxage=604800"
debug: bool = False
root_path: Optional[str] = None
stage: Optional[str] = None
Expand Down
11 changes: 11 additions & 0 deletions stac_api/infrastructure/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration options for the Lambda backed API implementing `stac-fastapi`."""

from typing import Dict, Optional

from pydantic import BaseSettings, Field
Expand Down Expand Up @@ -33,6 +34,16 @@ class vedaSTACSettings(BaseSettings):
description="Complete url of custom host including subdomain. When provided, override host in api integration",
)

project_name: Optional[str] = Field(
"VEDA (Visualization, Exploration, and Data Analysis)",
description="Name of the STAC Catalog",
)

project_description: Optional[str] = Field(
"VEDA (Visualization, Exploration, and Data Analysis) is NASA's open-source Earth Science platform in the cloud.",
description="Description of the STAC Catalog",
)

class Config:
"""model config"""

Expand Down
13 changes: 6 additions & 7 deletions stac_api/infrastructure/construct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CDK Construct for a Lambda backed API implementing stac-fastapi."""

import os
import typing
from typing import Optional
Expand Down Expand Up @@ -56,9 +57,13 @@ def __init__(
memory_size=veda_stac_settings.memory,
timeout=Duration.seconds(veda_stac_settings.timeout),
environment={
**{k.upper(): v for k, v in veda_stac_settings.env.items()},
"DB_MIN_CONN_SIZE": "0",
"DB_MAX_CONN_SIZE": "1",
**{k.upper(): v for k, v in veda_stac_settings.env.items()},
"VEDA_STAC_ROOT_PATH": veda_stac_settings.stac_root_path,
"VEDA_STAC_STAGE": stage,
"VEDA_STAC_PROJECT_NAME": veda_stac_settings.project_name,
"VEDA_STAC_PROJECT_DESCRIPTION": veda_stac_settings.project_description,
},
log_retention=aws_logs.RetentionDays.ONE_WEEK,
tracing=aws_lambda.Tracing.ACTIVE,
Expand All @@ -80,12 +85,6 @@ def __init__(
"VEDA_STAC_PGSTAC_SECRET_ARN", database.pgstac.secret.secret_full_arn
)

lambda_function.add_environment(
"VEDA_STAC_ROOT_PATH", veda_stac_settings.stac_root_path
)

lambda_function.add_environment("VEDA_STAC_STAGE", stage)

integration_kwargs = dict(handler=lambda_function)
if veda_stac_settings.custom_host:
integration_kwargs[
Expand Down
6 changes: 3 additions & 3 deletions stac_api/runtime/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@

api = VedaStacApi(
app=FastAPI(
title=api_settings.name,
title=f"{api_settings.project_name} STAC API",
openapi_url="/openapi.json",
docs_url="/docs",
root_path=api_settings.root_path,
),
title=api_settings.name,
description=api_settings.name,
title=f"{api_settings.project_name} STAC API",
description=api_settings.project_description,
settings=api_settings.load_postgres_settings(),
extensions=PgStacExtensions,
client=VedaCrudClient(post_request_model=POSTModel),
Expand Down
5 changes: 3 additions & 2 deletions stac_api/runtime/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def get_secret_dict(secret_name: str):
class _ApiSettings(pydantic.BaseSettings):
"""API settings"""

name: str = "veda-stac"
project_name: Optional[str] = "veda"
project_description: Optional[str] = None
cors_origins: str = "*"
cachecontrol: str = "public, max-age=3600"
cachecontrol: str = "max-age=30,must-revalidate,s-maxage=604800"
debug: bool = False
root_path: Optional[str] = None
pgstac_secret_arn: Optional[str]
Expand Down

0 comments on commit 5a559f6

Please sign in to comment.