-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
56 lines (51 loc) · 1.54 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
service: emoji-haiku
variablesResolutionMode: 20210219
frameworkVersion: "3"
provider:
name: aws
# Keep this in sync with the one in the Pipfile.
runtime: python3.9
package:
include:
- api/**
- datasources/**
- emoji/**
- haiku.py
- syllables.py
custom:
stage: ${opt:stage, self:provider.stage, "dev"}
tweetScheduleEnabled:
dev: false
production: true
functions:
haiku:
handler: api.entry.haiku_handler
events:
- http:
path: haiku
method: get
# I'm pretty sure we don't need this for GET requests - it's just for
# handling preflight requests - but I don't want to risk it.
cors: true
request:
parameters:
querystrings:
# false = Optional
modifier: false
# false = Optional
gender: false
tweet:
handler: api.tweeter.tweet_handler
events:
- schedule:
rate: rate(6 hours)
# This magic enables the schedule for prod, but not for dev.
enabled: ${self:custom.tweetScheduleEnabled.${self:custom.stage}}
environment:
TWITTER_CONSUMER_KEY: ${file(twitter-config.json):twitterConsumerKey}
TWITTER_CONSUMER_SECRET: ${file(twitter-config.json):twitterConsumerSecret}
TWITTER_ACCESS_TOKEN_KEY: ${file(twitter-config.json):twitterAccessTokenKey}
TWITTER_ACCESS_TOKEN_SECRET: ${file(twitter-config.json):twitterAccessTokenSecret}
plugins:
- serverless-python-requirements
- serverless-prune-plugin