forked from codu-code/codu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sst.config.ts
110 lines (107 loc) · 3.27 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { type SSTConfig } from "sst";
import { NextjsSite } from "sst/constructs";
import * as ssm from "aws-cdk-lib/aws-ssm";
export default {
config() {
return {
name: "codu",
region: "eu-west-1",
};
},
stacks(app) {
app.stack(function Site({ stack }) {
const domainName = app.stage === "dev" ? "dev1.codu.co" : "codu.co";
const bucketName = app.stage === "dev" ? "dev.codu" : "codu.uploads";
const wwwDomainName = `www.${domainName}`;
const {
ALGOLIA_ADMIN_KEY,
DATABASE_URL,
NEXT_PUBLIC_FATHOM_SITE_ID,
NEXT_PUBLIC_SENTRY_DSN,
} = process.env;
if (
!ALGOLIA_ADMIN_KEY ||
!DATABASE_URL ||
!NEXT_PUBLIC_FATHOM_SITE_ID ||
!NEXT_PUBLIC_SENTRY_DSN
) {
throw new Error(
`ALGOLIA_ADMIN_KEY, DATABASE_URL, NEXT_PUBLIC_FATHOM_SITE_ID and NEXT_PUBLIC_SENTRY_DSN are required`,
);
}
const site = new NextjsSite(stack, "site", {
// edge: true,
experimental: {
streaming: true,
},
permissions: ["ses", "s3"],
customDomain: {
domainName: wwwDomainName,
domainAlias: domainName,
hostedZone: domainName,
},
environment: {
S3_BUCKET_NAME: bucketName,
DATABASE_URL,
BASE_URL: `https://${wwwDomainName}`,
DOMAIN_NAME: wwwDomainName,
NEXTAUTH_URL: `https://${wwwDomainName}`,
NEXT_PUBLIC_FATHOM_SITE_ID: NEXT_PUBLIC_FATHOM_SITE_ID,
NEXT_PUBLIC_SENTRY_DSN: NEXT_PUBLIC_SENTRY_DSN,
SENTRY_ENVIRONMENT: ssm.StringParameter.valueFromLookup(
this,
"/env/sentry/environment",
),
SENTRY_DSN: ssm.StringParameter.valueFromLookup(
this,
"/env/sentry/dsn",
),
GITHUB_SECRET: ssm.StringParameter.valueFromLookup(
this,
"/env/githubSecret",
),
GITHUB_ID: ssm.StringParameter.valueFromLookup(this, "/env/githubId"),
NEXTAUTH_SECRET: ssm.StringParameter.valueFromLookup(
this,
"/env/nextauthSecret",
),
DISCORD_INVITE_URL: ssm.StringParameter.valueFromLookup(
this,
"/env/discordInviteUrl",
),
ADMIN_EMAIL: ssm.StringParameter.valueFromLookup(
this,
"/env/adminEmail",
),
ALGOLIA_APP_ID: ssm.StringParameter.valueFromLookup(
this,
"/env/algoliaAppId",
),
ALGOLIA_SEARCH_API: ssm.StringParameter.valueFromLookup(
this,
"/env/algoliaSearchApi",
),
ALGOLIA_SOURCE_IDX: ssm.StringParameter.valueFromLookup(
this,
"/env/algoliaIdx",
),
EMAIL_API_KEY: ssm.StringParameter.valueFromLookup(
this,
"/env/email/key",
),
EMAIL_API_ENDPOINT: ssm.StringParameter.valueFromLookup(
this,
"/env/email/endpoint",
),
EMAIL_NEWSLETTER_ID: ssm.StringParameter.valueFromLookup(
this,
"/env/email/id",
),
},
});
stack.addOutputs({
SiteUrl: site.url,
});
});
},
} satisfies SSTConfig;