-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsst.config.ts
75 lines (67 loc) · 1.53 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
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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "reimage",
removal: input?.stage === "production" ? "retain" : "remove",
protect: ["production"].includes(input?.stage),
home: "aws",
providers: {
aws: {
profile:
input.stage === "production"
? "shaikzeeshan-production"
: "shaikzeeshan-dev",
},
},
};
},
async run() {
const domain = $dev
? undefined
: {
name: "reimage.shaikzeeshan.me",
dns: sst.cloudflare.dns({
proxy: true,
}),
};
// S3 Bucket
const bucket = $dev
? new sst.aws.Bucket("ImageBucket-dev")
: new sst.aws.Bucket("ImageBucket");
// Database Secret
const ConnectionURL = new sst.Secret(
"TURSO_CONNECTION_URL",
"url used to connect your turso database",
);
const AuthToken = new sst.Secret(
"TURSO_AUTH_TOKEN",
"auth token to access your database",
);
// Drizzle Studio (only in dev mode)
new sst.x.DevCommand("Studio", {
link: [ConnectionURL, AuthToken],
dev: {
command: "npx drizzle-kit studio",
},
});
// API Gateway
const api = new sst.aws.ApiGatewayV2("MyApi", {
domain,
});
// Lambda Function (API)
const lambdaFunction = new sst.aws.Function("Hono", {
architecture: "arm64",
handler: "src/index.handler",
nodejs: {
install: ["sharp", "@libsql/client"],
},
link: [bucket, ConnectionURL, AuthToken],
memory: "2048 MB",
});
api.route("$default", lambdaFunction.arn);
return {
api: api.url,
};
},
});