-
Notifications
You must be signed in to change notification settings - Fork 1
/
sst.config.ts
64 lines (62 loc) · 2.11 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as cdk from "aws-cdk-lib";
import * as acm from "aws-cdk-lib/aws-certificatemanager";
import * as cf from "aws-cdk-lib/aws-cloudfront";
import type { SSTConfig } from "sst";
import { NextjsSite } from "sst/constructs";
export default {
config(_input) {
return {
name: "devcircle",
region: "ap-south-1",
};
},
stacks(app) {
app.stack(function Site({ stack }) {
const serverCachePolicy = new cf.CachePolicy(stack, "serverCache", {
queryStringBehavior: cf.CacheQueryStringBehavior.all(),
headerBehavior: cf.CacheCookieBehavior.none(),
cookieBehavior: cf.CacheCookieBehavior.none(),
defaultTtl: cdk.Duration.days(0),
maxTtl: cdk.Duration.days(365),
minTtl: cdk.Duration.days(0),
enableAcceptEncodingBrotli: true,
enableAcceptEncodingGzip: true,
});
const certificate = acm.Certificate.fromCertificateArn(
stack,
"Certificate",
process.env.CDK_CERTIFICATE_ARN!
);
const site = new NextjsSite(stack, "site", {
cdk: {
serverCachePolicy,
},
customDomain: {
isExternalDomain: true,
domainName: "www.devcircle.live",
cdk: {
certificate,
},
},
environment: {
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL!,
NEXT_PUBLIC_FB_APP_ID: process.env.NEXT_PUBLIC_FB_APP_ID!,
GOOGLE_ANALYTICS_MEASUREMENT_ID:
process.env.GOOGLE_ANALYTICS_MEASUREMENT_ID!,
NODE_ENV: process.env.NODE_ENV!,
DATABASE_URL: process.env.DATABASE_URL!,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET!,
UPLOADTHING_SECRET: process.env.UPLOADTHING_SECRET!,
UPLOADTHING_APP_ID: process.env.UPLOADTHING_APP_ID!,
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID!,
GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET!,
REDIS_URL: process.env.REDIS_URL!,
REDIS_SECRET: process.env.REDIS_SECRET!,
},
});
stack.addOutputs({
SiteUrl: site.url,
});
});
},
} satisfies SSTConfig;