-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
58 lines (55 loc) · 1.49 KB
/
serverless.yml
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
service:
name: app
custom:
env: ${file(env.${self:provider.stage}.json)}
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
# Add the serverless-webpack plugin
plugins:
- serverless-webpack
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
apiGateway:
minimumCompressionSize: 1024 # Enable gzip compression for responses > 1 KB
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
NODE_ENV: ${self:custom.env.NODE_ENV}
JWT_SECRET: ${self:custom.env.JWT_SECRET}
DB_NAME: ${self:custom.env.DB_NAME}
SECRET_ARN: ${self:custom.env.SECRET_ARN}
RESOURCE_ARN: ${self:custom.env.RESOURCE_ARN}
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'rds-data:ExecuteSql'
- 'rds-data:ExecuteStatement'
- 'rds-data:BatchExecuteStatement'
- 'rds-data:BeginTransaction'
- 'rds-data:RollbackTransaction'
- 'rds-data:CommitTransaction'
Resource: ${self:custom.env.RESOURCE_ARN}
- Effect: 'Allow'
Action:
- 'secretsmanager:GetSecretValue'
Resource: ${self:custom.env.SECRET_ARN}
functions:
graphql:
handler: src/graphql/serverless.handler
events:
- http:
cors: true
method: any
path: '/{proxy+}'
websocket:
handler: src/websocket/serverless.handler
events:
- websocket:
route: $connect
- websocket:
route: $disconnect
- websocket:
route: $default