|
1 | 1 | import { |
2 | 2 | Stack, |
3 | | - aws_ec2 as ec2, |
4 | 3 | aws_rds as rds, |
5 | 4 | aws_secretsmanager as secretsmanager, |
6 | 5 | } from "aws-cdk-lib"; |
7 | 6 | import { Construct } from "constructs"; |
8 | | -import { BootstrapPgStac } from "./bootstrap-pgstac"; |
| 7 | +import { BootstrapPgStac, BootstrapPgStacProps } from "./bootstrap-pgstac"; |
9 | 8 |
|
10 | 9 | /** |
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. |
14 | 13 | */ |
15 | 14 | export class PgStacDatabase extends Construct { |
16 | 15 | db: rds.DatabaseInstance; |
@@ -38,14 +37,19 @@ export class PgStacDatabase extends Construct { |
38 | 37 | vpc: props.vpc, |
39 | 38 | database: this.db, |
40 | 39 | 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, |
45 | 44 | }); |
46 | 45 |
|
47 | 46 | this.pgstacSecret = bootstrap.secret; |
48 | 47 | } |
49 | 48 | } |
50 | 49 |
|
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