-
Notifications
You must be signed in to change notification settings - Fork 5
/
sst.config.ts
50 lines (44 loc) Β· 1.3 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
import { getStage } from '@purple/serverless-git-branch-stage-plugin'
import type { SSTConfig } from 'sst'
import { AddTodoStack } from './stacks/add-todo/stack'
import { FrontendStack } from './stacks/frontend'
import { ResourcesStack } from './stacks/resources/stack'
import { TrpcApiStack } from './stacks/trpc-api/stack'
import { isProd, isStaging } from './stacks/utils'
const config: SSTConfig = {
config(globals) {
const stage = globals.stage ?? getStage()
return {
name: 'purple-stack',
stage,
region: stage === 'master' ? 'eu-central-1' : 'eu-central-1'
}
},
stacks(app) {
if (app.stage === 'master' && app.mode === 'dev') {
throw new Error('Cannot deploy master stage in dev mode')
}
app.setDefaultFunctionProps({
runtime: 'nodejs20.x',
architecture: 'arm_64',
logRetention: 'three_months',
logRetentionRetryOptions: { maxRetries: 100 },
tracing: 'disabled',
environment: {
// https://docs.powertools.aws.dev/lambda/typescript/latest/#environment-variables
POWERTOOLS_DEV: app.local ? 'true' : 'false',
POWERTOOLS_LOG_LEVEL: app.local
? 'DEBUG'
: isProd(app) || isStaging(app)
? 'WARN'
: 'INFO'
}
})
app
.stack(ResourcesStack)
.stack(AddTodoStack)
.stack(TrpcApiStack)
.stack(FrontendStack)
}
}
export default config