-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsst.config.ts
More file actions
85 lines (78 loc) · 1.84 KB
/
Copy pathsst.config.ts
File metadata and controls
85 lines (78 loc) · 1.84 KB
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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "hooper",
home: "cloudflare",
removal: input?.stage === "production" ? "retain" : "remove",
providers: {
aws: true,
"@pulumiverse/vercel": true,
"@upstash/pulumi": true,
},
};
},
async run() {
const TURSO_URL = new sst.Secret("TursoURL", "file:local.db");
const TURSO_TOKEN = new sst.Secret("TursoToken");
const OPENAI_API_KEY = new sst.Secret("OpenAiApiKey");
const RESEND_API_KEY = new sst.Secret("ResendApiKey");
const appDomain = $interpolate`${
$app.stage === "production" ? "hooper" : `${$app.stage}.hooper`
}.walln.dev`;
const dns = sst.vercel.dns({
domain: "walln.dev",
});
const auth = new sst.aws.Auth("Auth", {
authenticator: {
handler: "./packages/auth/src/server.handler",
url: true,
link: [TURSO_URL, TURSO_TOKEN, RESEND_API_KEY],
environment: {
WEB_URL: $dev
? "http://localhost:3000"
: $interpolate`https://${appDomain}`,
DEVELOPMENT_EMAILS: !$dev,
},
},
});
$linkable(upstash.RedisDatabase, function () {
return {
properties: {
endpoint: this.endpoint,
token: this.restToken,
},
};
});
const redis = new upstash.RedisDatabase("Redis", {
region: "us-east-1",
databaseName: $interpolate`hooper-${$app.stage}-redis`,
});
const web = new sst.aws.Nextjs("Web", {
path: "./apps/frontend",
domain: {
name: appDomain,
dns: dns,
},
environment: {
AUTH_URL: auth.authenticator.url,
WEB_URL: $dev
? "http://localhost:3000"
: $interpolate`https://${appDomain}`,
},
link: [
auth,
auth.authenticator,
redis,
TURSO_URL,
TURSO_TOKEN,
OPENAI_API_KEY,
RESEND_API_KEY,
],
});
return {
auth: auth.authenticator.url,
web: web.url,
};
},
});