forked from whitmanschorn/vehicle-sheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
84 lines (78 loc) · 2.5 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
# https://serverless.com/framework/docs/
service: streetmix-vehicle-profiles
custom:
secrets: ${file(secrets.json)}
provider:
name: aws
iamRoleStatements:
- Effect: Allow
Action:
- "s3:*"
Resource: arn:aws:s3:::ruhe-files/*
runtime: nodejs8.10
# stage: prod
stage: dev
# profile: personal
region: us-east-1
environment:
GDC_EMAIL: ${self:custom.secrets.gdcEmail} # Google sheets secret API key
GDC_SECRET_KEY: ${self:custom.secrets.gdcSecretKey} # Google sheets secret API key
SHEETS_SECRET_KEY: ${self:custom.secrets.sheetsSecretKey} # Google sheets secret API key
AUTH_CLIENT_ID: ${self:custom.secrets.authClientId} # Stripe secret API key
AUTH_CLIENT_SECRET: ${self:custom.secrets.authClientSecret} # Stripe secret API key
AUTH_SIGNING_SECRET: ${self:custom.secrets.authSigningSecret} # Stripe secret API key
AUTH_MANAGEMENT_SECRET: ${self:custom.secrets.authManagementSecret} # Stripe secret API key
# The `functions` block defines what code to deploy
functions:
auth:
handler: functions/auth.handler
cors: true
environment:
BUCKET: ${self:custom.secrets.bucket}
create:
handler: functions/createVehicle.handler
events:
- http:
path: vehicles
method: post
# authorizer: auth
cors: true
update:
handler: functions/updateVehicle.handler
events:
- http:
path: vehicles
method: put
# authorizer: auth
cors: true
vehicles:
handler: functions/getVehicles.handler
events:
- http:
path: vehicles
method: get
# authorizer: auth
cors: true
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'