@jaypie/constructs 1.1.30 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +17 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +18 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as apiGateway from 'aws-cdk-lib/aws-apigateway';
|
|
|
6
6
|
import * as route53 from 'aws-cdk-lib/aws-route53';
|
|
7
7
|
import { HostedZone } from 'aws-cdk-lib/aws-route53';
|
|
8
8
|
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets';
|
|
9
|
-
import { CDK as CDK$2, isValidSubdomain, ConfigurationError, isValidHostname
|
|
9
|
+
import { CDK as CDK$2, mergeDomain, isValidSubdomain, ConfigurationError, isValidHostname } from '@jaypie/cdk';
|
|
10
10
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
11
11
|
import * as s3n from 'aws-cdk-lib/aws-s3-notifications';
|
|
12
12
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
@@ -109,7 +109,23 @@ function stackTagger(stack, { name } = {}) {
|
|
|
109
109
|
class JaypieApiGateway extends Construct {
|
|
110
110
|
constructor(scope, id, props) {
|
|
111
111
|
super(scope, id);
|
|
112
|
-
const { certificate = true, handler, host, name, roleTag = CDK$2.ROLE.API, zone, } = props;
|
|
112
|
+
const { certificate = true, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
|
|
113
|
+
// Determine zone from props or environment
|
|
114
|
+
let zone = propsZone;
|
|
115
|
+
if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
116
|
+
zone = process.env.CDK_ENV_API_HOSTED_ZONE;
|
|
117
|
+
}
|
|
118
|
+
// Determine host from props or environment
|
|
119
|
+
let host = propsHost;
|
|
120
|
+
if (!host) {
|
|
121
|
+
if (process.env.CDK_ENV_API_HOST_NAME) {
|
|
122
|
+
host = process.env.CDK_ENV_API_HOST_NAME;
|
|
123
|
+
}
|
|
124
|
+
else if (process.env.CDK_ENV_API_SUBDOMAIN &&
|
|
125
|
+
process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
126
|
+
host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
113
129
|
const apiGatewayName = name || constructEnvName("ApiGateway");
|
|
114
130
|
const certificateName = constructEnvName("Certificate");
|
|
115
131
|
const apiDomainName = constructEnvName("ApiDomainName");
|