-
Notifications
You must be signed in to change notification settings - Fork 1
/
sst.config.ts
59 lines (53 loc) · 1.38 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
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "feedbackflowteamf",
removal: input?.stage === "prod" ? "retain" : "remove",
home: "aws",
};
},
async run() {
const AuthSecret = new sst.Secret("AuthSecret");
const PostgresURL = new sst.Secret("PostgresURL");
const OpenAIKey = new sst.Secret("OpenAIKey");
const bucket = new sst.aws.Bucket("FeedbackFlowBucket", {
public: true,
});
const queue = new sst.aws.Queue("FeedbackFlowQueueV3", {
fifo: true,
transform: {
queue: {
visibilityTimeoutSeconds: 900 * 6,
},
},
});
queue.subscribe(
{
link: [queue, PostgresURL],
handler: "handlers/subscriber.handler",
environment: {
POSTGRES_URL: PostgresURL.value,
OPENAI_KEY: OpenAIKey.value,
},
timeout: "900 seconds",
runtime: "nodejs20.x",
},
{
transform: {
eventSourceMapping: {
batchSize: 1,
},
},
},
);
new sst.aws.Nextjs("FeedbackFlowAppf", {
link: [bucket, queue, AuthSecret, PostgresURL],
environment: {
AUTH_SECRET: AuthSecret.value,
POSTGRES_URL: PostgresURL.value,
},
});
},
});