Skip to content

Commit

Permalink
ref(cdk): allowed for domain names, rewriten and upgraded, more modul…
Browse files Browse the repository at this point in the history
…ar and importable
  • Loading branch information
sladg committed Oct 30, 2022
1 parent f26ed88 commit 4b12360
Show file tree
Hide file tree
Showing 8 changed files with 423 additions and 183 deletions.
177 changes: 0 additions & 177 deletions lib/cdk-app.ts

This file was deleted.

35 changes: 35 additions & 0 deletions lib/cdk/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { App } from 'aws-cdk-lib'
import path from 'path'
import { NextStandaloneStack } from './stack'

const app = new App()

if (!process.env.STACK_NAME) {
throw new Error('Name of CDK stack was not specified!')
}

const commandCwd = process.cwd()

// This is configured in rollup as exported file is in dist folder.
const cdkFolder = __dirname

new NextStandaloneStack(app, process.env.STACK_NAME, {
apigwServerPath: '/_server',
apigwImagePath: '/_image',
assetsZipPath: path.resolve(commandCwd, './next.out/assetsLayer.zip'),
codeZipPath: path.resolve(commandCwd, './next.out/code.zip'),
dependenciesZipPath: path.resolve(commandCwd, './next.out/dependenciesLayer.zip'),
imageHandlerZipPath: path.resolve(cdkFolder, '../dist/image-handler.zip'),
customServerHandler: 'handler.handler',
customImageHandler: 'handler.handler',
lambdaTimeout: process.env.LAMBDA_TIMEOUT ? Number(process.env.LAMBDA_TIMEOUT) : 15,
lambdaMemory: process.env.LAMBDA_MEMORY ? Number(process.env.LAMBDA_MEMORY) : 1024,
hostedZone: process.env.HOSTED_ZONE ?? undefined,
dnsPrefix: process.env.DNS_PREFIX ?? undefined,
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
},
})

app.synth()
Loading

0 comments on commit 4b12360

Please sign in to comment.