-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsst.config.ts
64 lines (64 loc) · 2.16 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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "raba",
removal: input?.stage === "prod" ? "retain" : "remove",
home: "aws",
providers: { cloudflare: "5.43.1" },
};
},
async run() {
const fileUploadsBucket = new sst.aws.Bucket("FileUploads", {
public: true,
});
const userUploadsTable = new sst.aws.Dynamo("UserUploads", {
fields: {
uploadId: "string",
senderEmail: "string",
recipientEmail: "string",
// title: "string",
// description: "string",
// chargeCode: "string",
// fileUrl: "string",
// createdAt: "string",
// expiresOn: "string",
},
primaryIndex: { hashKey: "senderEmail", rangeKey: "uploadId" },
globalIndexes: {
uploadIdIndex: { hashKey: "uploadId" },
recipientEmailIndex: { hashKey: "recipientEmail" },
},
});
const deleteCronJob = new sst.aws.Cron("RabaDeleteCronJob", {
job: {
handler: "functions/delete.handler",
runtime: "nodejs20.x",
link: [fileUploadsBucket, userUploadsTable],
},
schedule: "rate(1 hour)",
});
const auth0Secret = new sst.Secret("Auth0Secret");
const auth0BaseUrl = new sst.Secret("Auth0BaseUrl");
const auth0IssuerBaseUrl = new sst.Secret("Auth0IssuerBaseUrl");
const auth0ClientId = new sst.Secret("Auth0ClientId");
const auth0ClientSecret = new sst.Secret("Auth0ClientSecret");
new sst.aws.Nextjs("WebUi", {
domain: {
name: `${$app.stage !== "prod" ? `${$app.stage}-` : ""}${
$app.name
}.brianprost.com`,
dns: sst.cloudflare.dns(),
},
link: [fileUploadsBucket, userUploadsTable],
environment: {
// todo: change these to just use the values in the runtime from secrets manager: https://sst.dev/docs/environment-variables/
AUTH0_SECRET: auth0Secret.value,
AUTH0_BASE_URL: auth0BaseUrl.value,
AUTH0_ISSUER_BASE_URL: auth0IssuerBaseUrl.value,
AUTH0_CLIENT_ID: auth0ClientId.value,
AUTH0_CLIENT_SECRET: auth0ClientSecret.value,
},
});
},
});