Skip to content

Commit a23356f

Browse files
committed
feat: Support customizing bootstrap args
from pgStacDatabase. Improve docs
1 parent 8657662 commit a23356f

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

lib/bootstrap-pgstac/index.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class BootstrapPgStac extends Construct {
3131
runtime: aws_lambda.Runtime.PYTHON_3_8,
3232
code: aws_lambda.Code.fromDockerBuild(__dirname, {
3333
file: "runtime/Dockerfile",
34-
buildArgs: { PGSTAC_VERSION: props.pgstacVersion },
34+
buildArgs: { PGSTAC_VERSION: props.pgstacVersion || "0.6.8" },
3535
}),
3636
timeout: Duration.minutes(2),
3737
vpc: hasVpc(props.database) ? props.database.vpc : props.vpc,
@@ -112,26 +112,28 @@ export interface BootstrapPgStacProps {
112112
/**
113113
* Name of database that is to be created and onto which pgSTAC will be installed.
114114
*
115-
* @default - "pgstac"
115+
* @default pgstac
116116
*/
117117
readonly pgstacDbName?: string;
118118

119119
/**
120120
* Name of user that will be generated for connecting to the pgSTAC database.
121121
*
122-
* @default - "pgstac_user"
122+
* @default pgstac_user
123123
*/
124124
readonly pgstacUsername?: string;
125125

126126
/**
127127
* pgSTAC version to be installed.
128+
*
129+
* @default 0.6.8
128130
*/
129-
readonly pgstacVersion: string;
131+
readonly pgstacVersion?: string;
130132

131133
/**
132134
* Prefix to assign to the generated `secrets_manager.Secret`
133135
*
134-
* @default - "pgstac"
136+
* @default pgstac
135137
*/
136-
readonly secretsPrefix: string;
138+
readonly secretsPrefix?: string;
137139
}

lib/database.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import {
22
Stack,
3-
aws_ec2 as ec2,
43
aws_rds as rds,
54
aws_secretsmanager as secretsmanager,
65
} from "aws-cdk-lib";
76
import { Construct } from "constructs";
8-
import { BootstrapPgStac } from "./bootstrap-pgstac";
7+
import { BootstrapPgStac, BootstrapPgStacProps } from "./bootstrap-pgstac";
98

109
/**
11-
* An RDS instance with pgSTAC installed.
12-
*
13-
* Will default to installing a `t3.small` Postgres instance.
10+
* An RDS instance with pgSTAC installed. This is a wrapper around the
11+
* `rds.DatabaseInstance` higher-level construct making use
12+
* of the BootstrapPgStac construct.
1413
*/
1514
export class PgStacDatabase extends Construct {
1615
db: rds.DatabaseInstance;
@@ -38,14 +37,19 @@ export class PgStacDatabase extends Construct {
3837
vpc: props.vpc,
3938
database: this.db,
4039
dbSecret: this.db.secret!,
41-
pgstacDbName: "pgstac",
42-
pgstacVersion: "0.6.8",
43-
pgstacUsername: "pgstac_user",
44-
secretsPrefix: "pgstac",
40+
pgstacDbName: props.pgstacDbName,
41+
pgstacVersion: props.pgstacVersion,
42+
pgstacUsername: props.pgstacUsername,
43+
secretsPrefix: props.secretsPrefix,
4544
});
4645

4746
this.pgstacSecret = bootstrap.secret;
4847
}
4948
}
5049

51-
export interface PgStacDatabaseProps extends rds.DatabaseInstanceProps {}
50+
export interface PgStacDatabaseProps extends rds.DatabaseInstanceProps {
51+
readonly pgstacDbName?: BootstrapPgStacProps["pgstacDbName"];
52+
readonly pgstacVersion?: BootstrapPgStacProps["pgstacVersion"];
53+
readonly pgstacUsername?: BootstrapPgStacProps["pgstacUsername"];
54+
readonly secretsPrefix?: BootstrapPgStacProps["secretsPrefix"];
55+
}

0 commit comments

Comments
 (0)