forked from sst/guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsst.config.ts
49 lines (46 loc) · 1.42 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
import { SSTConfig } from "sst";
import { StaticSite } from "sst/constructs";
import { HostedZone } from "aws-cdk-lib/aws-route53";
import { HttpsRedirect } from "aws-cdk-lib/aws-route53-patterns";
export default {
config(_input) {
return {
name: "sst-dev",
region: "us-east-1",
};
},
stacks(app) {
app.stack(function Site({ stack }) {
const site = new StaticSite(stack, "site", {
customDomain:
stack.stage === "prod"
? {
domainName: "sst.dev",
domainAlias: "www.sst.dev",
}
: stack.stage.startsWith("branchv")
? {
hostedZone: "archives.sst.dev",
domainName: `${stack.stage}.archives.sst.dev`,
}
: undefined,
errorPage: "404.html",
buildOutput: "_site",
buildCommand: "bundle install && bundle exec jekyll build",
});
// Redirect serverless-stack.com to sst.dev
if (stack.stage === "prod") {
new HttpsRedirect(stack, "Redirect", {
recordNames: ["serverless-stack.com", "www.serverless-stack.com"],
targetDomain: "sst.dev",
zone: HostedZone.fromLookup(stack, "HostedZone", {
domainName: "serverless-stack.com",
}),
});
}
stack.addOutputs({
Url: site.customDomainUrl || site.url,
});
});
},
} satisfies SSTConfig;