Skip to content

Commit

Permalink
feat: configure pgstac version in custom properties (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago authored Feb 4, 2025
1 parent b222426 commit a29ea21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/database/bootstrapper_runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 9 additions & 3 deletions lib/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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", {
Expand Down Expand Up @@ -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`
*
Expand Down

0 comments on commit a29ea21

Please sign in to comment.