-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
112 lines (104 loc) · 2.77 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
107
108
109
110
111
112
org: alphaser
app: worklogger
service: worklogger
provider:
name: aws
runtime: nodejs16.x
httpApi:
disableDefaultEndpoint: true
endpointType: regional
stage: ${opt:stage, 'dev'}
environment:
STAGE: ${self:provider.stage}
iam:
role:
statements:
- Effect: "Allow"
Action:
- "s3:PutObject"
- "s3:GetObject"
Resource:
- "arn:aws:s3:::${self:custom.environments.${self:provider.stage}.S3_BUCKET}/*"
- "arn:aws:s3:::${self:custom.environments.${self:provider.stage}.S3_BUCKET}"
- "arn:aws:s3:::worklogger/*"
- "arn:aws:s3:::worklogger"
- Effect: "Allow"
Action:
- "ses:SendEmail"
Resource: "*"
functions:
logTimesheets:
handler: lambdaHandler.logTimesheets
name: worklogger-logTimesheets-${opt:stage, 'dev'}
description: Logs timesheets from different sources
memorySize: 128
timeout: 60
package:
patterns:
- "*.mjs"
- "app/**/*.mjs"
events:
- schedule:
rate: cron(0 11 * * ? *)
enabled: ${self:custom.environments.${self:provider.stage}.SCHEDULE_ENABLED}
description: Daily run
input:
s3: ${self:custom.environments.${self:provider.stage}.S3_BUCKET}
c: daily_configuration.json
- schedule:
rate: cron(0 11 1 * ? *)
enabled: ${self:custom.environments.${self:provider.stage}.SCHEDULE_ENABLED}
description: Monthly run
input:
s3: ${self:custom.environments.${self:provider.stage}.S3_BUCKET}
c: monthly_configuration.json
tokenLogger:
handler: lambdaHandler.storeToken
name: worklogger-storeToken-${opt:stage, 'dev'}
description: Stores the token from the OAuth flow
memorySize: 128
timeout: 29
package:
patterns:
- "*.mjs"
- "app/**/*.mjs"
events:
- http:
path: /token
method: get
cors: true
login:
handler: lambdaHandler.loginRedirect
name: worklogger-loginRedirect-${opt:stage, 'dev'}
description: Redirects to the OAuth flow
memorySize: 128
timeout: 29
package:
patterns:
- "*.mjs"
- "app/**/*.mjs"
events:
- http:
path: /login
method: get
plugins:
- serverless-offline
- serverless-event-constant-inputs
- serverless-webpack
custom:
webpack:
webpackConfig: 'webpack.config.cjs'
includeModules: true
packager: 'npm'
keepOutputDirectory: true
isProd: ${self:provider.stage, 'dev'}
environments:
prod:
SCHEDULE_ENABLED: true
S3_BUCKET: worklogger
dev:
SCHEDULE_ENABLED: false
S3_BUCKET: worklogger
build:
esbuild: false
configValidationMode: error