-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsst.config.example.ts
More file actions
60 lines (57 loc) · 1.96 KB
/
sst.config.example.ts
File metadata and controls
60 lines (57 loc) · 1.96 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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "stackpanel",
removal: input?.stage === "prod" ? "retain" : "remove",
protect: ["prod"].includes(input?.stage),
home: "cloudflare",
};
},
async run() {
// ========================================================================
// Secrets (set via: bunx sst secret set SecretName value)
// ========================================================================
const databaseUrl = new sst.Secret("DatabaseUrl");
const betterAuthSecret = new sst.Secret("BetterAuthSecret");
const polarAccessToken = new sst.Secret("PolarAccessToken");
const googleAiKey = new sst.Secret("GoogleAiKey");
const redisUrl = new sst.Secret("RedisUrl");
const redisToken = new sst.Secret("RedisToken");
// ========================================================================
// Web App: TanStack Start on Cloudflare Workers
// ========================================================================
const web = new sst.cloudflare.Worker("Web", {
handler: "apps/web/dist/server/index.js",
url: true,
build: {
command: "cd apps/web && bun run build",
},
link: [databaseUrl, betterAuthSecret, polarAccessToken],
environment: {
CORS_ORIGIN:
$app.stage === "prod"
? "https://stackpanel.com"
: "http://localhost:3001",
BETTER_AUTH_URL:
$app.stage === "prod"
? "https://stackpanel.com"
: "http://localhost:3001",
POLAR_SUCCESS_URL:
$app.stage === "prod"
? "https://stackpanel.com/success?checkout_id={CHECKOUT_ID}"
: "http://localhost:3001/success?checkout_id={CHECKOUT_ID}",
},
dev: {
command: "cd apps/web && bun run dev",
url: "http://localhost:3001",
},
});
// ========================================================================
// Outputs
// ========================================================================
return {
web: web.url,
};
},
});