@jaypie/constructs 1.2.1 → 1.2.2
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/JaypieNextJs.d.ts +15 -1
- package/dist/cjs/index.cjs +5 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/esm/JaypieNextJs.d.ts +15 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,23 @@ import { IHostedZone } from "aws-cdk-lib/aws-route53";
|
|
|
2
2
|
import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
4
|
import { EnvironmentInput, SecretsArrayItem } from "./helpers";
|
|
5
|
+
export interface DomainNameConfig {
|
|
6
|
+
component?: string;
|
|
7
|
+
domain?: string;
|
|
8
|
+
env?: string;
|
|
9
|
+
subdomain?: string;
|
|
10
|
+
}
|
|
5
11
|
export interface JaypieNextjsProps {
|
|
6
12
|
datadogApiKeyArn?: string;
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Domain name for the Next.js application.
|
|
15
|
+
*
|
|
16
|
+
* Supports both string and config object:
|
|
17
|
+
* - String: used directly as the domain name
|
|
18
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
19
|
+
* - { component, domain, env, subdomain }
|
|
20
|
+
*/
|
|
21
|
+
domainName?: string | DomainNameConfig;
|
|
8
22
|
/**
|
|
9
23
|
* Environment variables for the Next.js application.
|
|
10
24
|
*
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -390,7 +390,8 @@ function envHostname({ component, domain, env, subdomain, } = {}) {
|
|
|
390
390
|
throw new errors.ConfigurationError("No hostname `domain` provided. Set CDK_ENV_DOMAIN or CDK_ENV_HOSTED_ZONE to use environment domain");
|
|
391
391
|
}
|
|
392
392
|
const resolvedComponent = component === "@" || component === "" ? undefined : component;
|
|
393
|
-
const
|
|
393
|
+
const providedSubdomain = subdomain === "@" || subdomain === "" ? undefined : subdomain;
|
|
394
|
+
const resolvedSubdomain = providedSubdomain || process.env.CDK_ENV_SUBDOMAIN;
|
|
394
395
|
const resolvedEnv = env || process.env.PROJECT_ENV;
|
|
395
396
|
const filteredEnv = resolvedEnv === CDK$2.ENV.PRODUCTION ? undefined : resolvedEnv;
|
|
396
397
|
const parts = [
|
|
@@ -2595,7 +2596,9 @@ class JaypieMongoDbSecret extends JaypieEnvSecret {
|
|
|
2595
2596
|
class JaypieNextJs extends constructs.Construct {
|
|
2596
2597
|
constructor(scope, id, props) {
|
|
2597
2598
|
super(scope, id);
|
|
2598
|
-
const domainName = props?.domainName
|
|
2599
|
+
const domainName = typeof props?.domainName === "string"
|
|
2600
|
+
? props.domainName
|
|
2601
|
+
: envHostname(props?.domainName);
|
|
2599
2602
|
this.domainName = domainName;
|
|
2600
2603
|
const domainNameSanitized = domainName
|
|
2601
2604
|
.replace(/\./g, "-")
|