-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsst.config.ts
46 lines (41 loc) · 1.41 KB
/
sst.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/// <reference path="./.sst/platform/config.d.ts" />
import dotenv from 'dotenv';
import { env } from './src/env';
export default $config({
app(input) {
return {
name: 'decent-nextjs-starter-template',
removal: input?.stage === 'production' ? 'retain' : 'remove',
home: 'aws',
};
},
async run() {
const envFile = $dev ? '.env' : `.env.${$app.stage}`;
const { parsed: environment } = dotenv.config({ path: envFile });
const config: sst.aws.NextjsArgs = {
openNextVersion: '3.0.6',
environment: {
SST_STAGE: $app.stage,
...environment,
// these are picked up via their SENTRY_* versions, so we don't need to explicitly list them
NEXT_PUBLIC_SENTRY_DSN: process.env.SENTRY_DSN || '',
NEXT_PUBLIC_SENTRY_DEBUG: process.env.SENTRY_DEBUG || '',
},
};
if (!$dev) {
if (env.SITE_HOSTNAME) config.domain = env.SITE_HOSTNAME;
if (process.env.WARM) config.warm = parseInt(process.env.WARM || '0', 10);
// Check https://github.com/sst/ion/issues/632 if this is still needed
if (env.CLOUDFRONT_DISTRIBUTION_ID)
config.permissions = [
{
actions: ['cloudfront:CreateInvalidation'],
resources: [
`arn:aws:cloudfront::*:distribution/${env.CLOUDFRONT_DISTRIBUTION_ID || '*'}`,
],
},
];
}
new sst.aws.Nextjs('Site', config);
},
});