From a29ea216dbb4631081f052c312ee9c7957276dae Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Tue, 4 Feb 2025 17:53:32 +0100 Subject: [PATCH] feat: configure pgstac version in custom properties (#123) --- lib/database/bootstrapper_runtime/Dockerfile | 4 +--- lib/database/index.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/database/bootstrapper_runtime/Dockerfile b/lib/database/bootstrapper_runtime/Dockerfile index b466608..2184e6d 100644 --- a/lib/database/bootstrapper_runtime/Dockerfile +++ b/lib/database/bootstrapper_runtime/Dockerfile @@ -1,13 +1,11 @@ ARG PYTHON_VERSION FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} -ARG PGSTAC_VERSION -RUN echo "PGSTAC_VERSION: ${PGSTAC_VERSION}" RUN echo "PYTHON_VERSION: ${PYTHON_VERSION}" WORKDIR /tmp -RUN pip install httpx psycopg[binary,pool] pypgstac==${PGSTAC_VERSION} -t /asset +RUN pip install httpx psycopg[binary,pool] pypgstac -t /asset COPY bootstrapper_runtime/handler.py /asset/handler.py diff --git a/lib/database/index.ts b/lib/database/index.ts index 73ac281..5e47df7 100644 --- a/lib/database/index.ts +++ b/lib/database/index.ts @@ -79,8 +79,7 @@ export class PgStacDatabase extends Construct { code: aws_lambda.Code.fromDockerBuild(__dirname, { file: "bootstrapper_runtime/Dockerfile", buildArgs: { - PGSTAC_VERSION: DEFAULT_PGSTAC_VERSION, - PYTHON_VERSION: "3.11", + PYTHON_VERSION: "3.11" }, }), vpc: hasVpc(this.db) ? this.db.vpc : props.vpc, @@ -131,7 +130,7 @@ export class PgStacDatabase extends Construct { // if props.lambdaFunctionOptions doesn't have 'code' defined, update pgstac_version (needed for default runtime) if (!props.bootstrapperLambdaFunctionOptions?.code) { - customResourceProperties["pgstac_version"] = DEFAULT_PGSTAC_VERSION; + customResourceProperties["pgstac_version"] = props.pgstacVersion || DEFAULT_PGSTAC_VERSION; } // this.connections = props.database.connections; const bootstrapper = new CustomResource(this, "bootstrapper", { @@ -226,6 +225,13 @@ export interface PgStacDatabaseProps extends rds.DatabaseInstanceProps { */ readonly pgstacDbName?: string; + /** + * Version of pgstac to install on the database + * + * @default 0.8.5 + */ + readonly pgstacVersion?: string; + /** * Prefix to assign to the generated `secrets_manager.Secret` *