-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
53 lines (46 loc) · 1.3 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
service: evan-bot
plugins:
- serverless-python-requirements
custom:
stage: "${opt:stage, env:SLS_STAGE, 'dev'}"
log_level: "${env:LOG_LEVEL, 'INFO'}"
pythonRequirements:
dockerizePip: false
slim: true
provider:
name: aws
# if you change the python runtime, lxml binaries need to be built.
# see instructions here: https://stackoverflow.com/a/64749142/222173
runtime: python3.8
stage: ${self:custom.stage}
region: eu-west-1
environment:
LOG_LEVEL: ${self:custom.log_level}
TELEGRAM_TOKEN: ${env:TELEGRAM_TOKEN}
OPENAI_API_KEY: ${env:OPENAI_API_KEY}
stackTags:
x-service: evan-bot
x-stack: ${self:service}-${self:provider.stage}
apiGateway:
shouldStartNameWithService: true
package:
patterns:
- '!env/**'
- '!node_modules/**'
functions:
# for this webhook to work, you need to set it (once after deploy)
# note the endpoint url, then:
# curl --request POST \
# --url https://api.telegram.org/bot{TELEGRAM_TOKEN}/setWebhook \
# --header 'content-type: application/json' \
# --data '{"url": "{ENDPOINT_URL}"}'
webhook:
handler: handlers/webhook.handler
description: "Webhook handler"
memorySize: 256
timeout: 30
events:
- http:
path: "${env:WEBHOOK_PATH, 'webhook'}"
method: post
cors: true