@@ -6,7 +6,7 @@ import { CloudFrontDistribution } from '../constructs/CloudFrontDistribution'
66import { OriginResponseLambdaEdge } from '../constructs/OriginResponseLambdaEdge'
77import { ViewerResponseLambdaEdge } from '../constructs/ViewerResponseLambdaEdge'
88import { ViewerRequestLambdaEdge } from '../constructs/ViewerRequestLambdaEdge'
9- import { CacheConfig , NextRedirects } from '../../types'
9+ import { DeployConfig , NextRedirects } from '../../types'
1010
1111export interface NextCloudfrontStackProps extends StackProps {
1212 nodejs ?: string
@@ -16,9 +16,10 @@ export interface NextCloudfrontStackProps extends StackProps {
1616 renderWorkerQueueUrl : string
1717 renderWorkerQueueArn : string
1818 buildOutputPath : string
19- cacheConfig : CacheConfig
19+ deployConfig : DeployConfig
2020 imageTTL ?: number
2121 redirects ?: NextRedirects
22+ trailingSlash ?: boolean
2223}
2324
2425export class NextCloudfrontStack extends Stack {
@@ -38,33 +39,36 @@ export class NextCloudfrontStack extends Stack {
3839 renderWorkerQueueUrl,
3940 renderWorkerQueueArn,
4041 region,
41- cacheConfig ,
42+ deployConfig ,
4243 imageTTL,
43- redirects
44+ redirects,
45+ trailingSlash = false
4446 } = props
4547
4648 this . originRequestLambdaEdge = new OriginRequestLambdaEdge ( this , `${ id } -OriginRequestLambdaEdge` , {
4749 nodejs,
4850 bucketName : staticBucketName ,
4951 renderServerDomain,
5052 buildOutputPath,
51- cacheConfig,
53+ cacheConfig : deployConfig . cache ,
5254 bucketRegion : region
5355 } )
5456
5557 this . originResponseLambdaEdge = new OriginResponseLambdaEdge ( this , `${ id } -OriginResponseLambdaEdge` , {
5658 nodejs,
5759 renderWorkerQueueUrl,
5860 buildOutputPath,
59- cacheConfig,
61+ cacheConfig : deployConfig . cache ,
6062 renderWorkerQueueArn,
6163 region
6264 } )
6365
6466 this . viewerRequestLambdaEdge = new ViewerRequestLambdaEdge ( this , `${ id } -ViewerRequestLambdaEdge` , {
6567 buildOutputPath,
6668 nodejs,
67- redirects
69+ redirects,
70+ internationalizationConfig : deployConfig . internationalization ,
71+ trailingSlash
6872 } )
6973
7074 this . viewerResponseLambdaEdge = new ViewerResponseLambdaEdge ( this , `${ id } -ViewerResponseLambdaEdge` , {
@@ -84,7 +88,7 @@ export class NextCloudfrontStack extends Stack {
8488 responseEdgeFunction : this . originResponseLambdaEdge . lambdaEdge ,
8589 viewerResponseEdgeFunction : this . viewerResponseLambdaEdge . lambdaEdge ,
8690 viewerRequestLambdaEdge : this . viewerRequestLambdaEdge . lambdaEdge ,
87- cacheConfig,
91+ cacheConfig : deployConfig . cache ,
8892 imageTTL
8993 } )
9094
0 commit comments