-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsst.config.ts
More file actions
72 lines (65 loc) · 1.7 KB
/
sst.config.ts
File metadata and controls
72 lines (65 loc) · 1.7 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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "pyclashbot-site",
removal: input?.stage === "production" ? "retain" : "remove",
protect: ["production"].includes(input?.stage),
home: "aws",
providers: {
aws: {
profile: "pyclashbot",
region: "us-east-1",
},
},
};
},
async run() {
const stage = $app.stage;
const isProduction = stage === "production";
// Secrets
const apiRouteSecret = new sst.Secret("ApiRouteSecret");
const discordWebhookRelease = new sst.Secret("DiscordWebhookRelease");
const discordWebhookPrerelease = new sst.Secret("DiscordWebhookPrerelease");
const githubToken = new sst.Secret("GithubToken");
const baseDomain = isProduction
? "pyclashbot.app"
: `${stage}.pyclashbot.app`;
const dns = sst.aws.dns({
zone: "Z018325532CS6EQFY59HX",
});
const router = new sst.aws.Router("ApiRouter", {
domain: {
name: baseDomain,
aliases: isProduction ? [`www.${baseDomain}`] : undefined,
dns,
},
});
new sst.aws.TanStackStart("PyclashbotSite", {
router: {
instance: router,
},
environment: {
API_ROUTE_SECRET: apiRouteSecret.value,
DISCORD_WEBHOOK_RELEASE: discordWebhookRelease.value,
DISCORD_WEBHOOK_PRERELEASE: discordWebhookPrerelease.value,
GITHUB_TOKEN: githubToken.value,
ANALYTICS_ID: process.env.ANALYTICS_ID || "",
},
});
},
console: {
autodeploy: {
target(event) {
if (event.type === "branch" && event.action === "pushed") {
if (event.branch === "develop") {
return { stage: "develop" };
}
if (event.branch === "master") {
return { stage: "production" };
}
}
},
},
},
});