-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsst.config.ts
More file actions
58 lines (50 loc) · 1.57 KB
/
sst.config.ts
File metadata and controls
58 lines (50 loc) · 1.57 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
/// <reference path="./.sst/platform/config.d.ts" />
const region = "us-east-2";
const hostname = "duc.ducflair.com";
const server_url = "https://" + hostname;
const dev_server_url = "http://localhost:3000";
export default $config({
app(input) {
return {
name: "duc",
removal: input?.stage === "production" ? "retain" : "remove",
protect: ["production"].includes(input?.stage),
home: "aws",
aws: {
region,
},
cloudflare: "5.41.0",
};
},
async run() {
const isProduction = Boolean($app.stage === "production" && !$dev);
const isPreview = Boolean($app.stage !== "production" && !$dev);
const stageHostname = $app.stage === 'preview' ? `${$app.stage}-${hostname}` : undefined;
const domainName = isProduction
? hostname
: $app.stage === 'preview' ? `preview-${hostname}` : undefined;
// Secrets - https://sst.dev/docs/component/secret
const secrets: sst.Secret[] = [];
// secrets.push();
// Host a Next.js app - https://sst.dev/docs/start/aws/nextjs
new sst.aws.Nextjs("MyWeb", {
// vpc
domain: domainName && {
name: domainName,
dns: sst.cloudflare.dns({ proxy: true }),
},
path: "apps/web",
link: [
...secrets,
],
environment: {
DEV: $dev ? "true" : "false",
PREVIEW: isPreview ? "true" : "false",
PRODUCTION: isProduction ? "true" : "false",
NEXT_PUBLIC_SERVER_URL: isProduction
? server_url
: $dev ? dev_server_url : `https://${stageHostname}`,
},
});
},
});