-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
106 lines (99 loc) · 2.67 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
service: beakyn-slack-open-map
frameworkVersion: '>=1.1.0 <2.0.0'
provider:
name: aws
region: us-east-1
runtime: nodejs12.x
memorySize: 256
timeout: 30
logRetentionInDays: 90
stackTags:
Contractor: 'Beakyn'
Owner: '[email protected]'
Project: 'Slack Map'
tags:
Contractor: 'Beakyn'
Owner: '[email protected]'
Project: 'Slack Map'
environment:
SLACK_BOT_TOKEN: ${env:SLACK_BOT_TOKEN}
AWS_S3_UPLOAD_BUCKET: ${env:AWS_S3_UPLOAD_BUCKET}
ROOT_URL: ${env:ROOT_URL}
NODE_ENV: ${env:NODE_ENV}
functions:
eventCatch:
handler: src/functions/event.eventCatch
description: Slack Map / Catch Event
iamRoleStatements:
- Effect: 'Allow'
Action:
- 's3:PutObject'
- 's3:PutObjectAcl'
Resource: 'arn:aws:s3:::${env:AWS_S3_UPLOAD_BUCKET}/*'
events:
- http:
path: /event
method: post
cors:
origin: '*'
headers:
- Content-Type
- content-type
- Authorization
- authorization
- X-Tenant-ID
- x-tenant-id
actionCatch:
handler: src/functions/action.actionCatch
description: Slack Map / Catch Action
events:
- http:
path: /action
method: post
cors:
origin: '*'
headers:
- Content-Type
- content-type
- Authorization
- authorization
- X-Tenant-ID
- x-tenant-id
resources:
Resources:
# This response is needed for custom authorizer failures cors support ¯\_(ツ)_/¯
GatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: EXPIRED_TOKEN
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
AuthFailureGatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: UNAUTHORIZED
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
plugins:
- serverless-iam-roles-per-function
- serverless-plugin-typescript
- serverless-offline
- serverless-content-encoding
- serverless-prune-plugin
- serverless-plugin-optimize
package:
individually: true
custom:
contentEncoding:
minimumCompressionSize: 0
prune:
automatic: true
number: 3