-
Notifications
You must be signed in to change notification settings - Fork 0
/
sst.config.ts
78 lines (69 loc) · 1.98 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
76
77
78
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "x-vault",
removal: input?.stage === "production" ? "retain" : "remove",
home: "aws",
providers: {
aws: {
region: "us-east-1",
},
},
};
},
async run() {
const MONGODB_PASSWORD = new sst.Secret("XMongoDBPassword");
const MONGODB_USERNAME = new sst.Secret("XMongoDBUsername");
const MONGODB_DATABASE = new sst.Secret("XMongoDBDatabase");
const MONGODB_HOST = new sst.Secret("XMongoDBHost");
const GOOGLE_CLIENT_ID = new sst.Secret("GoogleClientId");
const GOOGLE_CLIENT_SECRET = new sst.Secret("GoogleClientSecret");
const AUTH_SECRET = new sst.Secret("NextAuthSecret");
const TOGETHER_API_KEY = new sst.Secret("TogetherAPIKey");
const bucket = new sst.aws.Bucket("XVaultBucketWeb", {
public: true,
});
new sst.aws.Nextjs("XVaultWeb", {
path: "./packages/web",
link: [
bucket,
MONGODB_PASSWORD,
MONGODB_USERNAME,
MONGODB_DATABASE,
MONGODB_HOST,
GOOGLE_CLIENT_ID,
GOOGLE_CLIENT_SECRET,
AUTH_SECRET,
],
environment: {
AUTH_SECRET: AUTH_SECRET.value,
},
});
const tweetHonoHandler = new sst.aws.Function("TweetHandler", {
handler: "./packages/functions/tweet.handler",
url: true,
link: [
MONGODB_PASSWORD,
MONGODB_USERNAME,
MONGODB_DATABASE,
MONGODB_HOST,
TOGETHER_API_KEY,
],
});
// const bookHonoHandler = new sst.aws.Function("BookHandler", {
// handler: "./packages/functions/book.handler",
// url: true,
// });
const router = new sst.aws.Router("HonoRouter", {
routes: {
"/tweet/v1/*": tweetHonoHandler.url,
},
});
return {
routerUrl: router.url,
tweetHandlerUrl: tweetHonoHandler.url,
// bookHandlerUrl: bookHonoHandler.url,
};
},
});