-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.js
More file actions
56 lines (53 loc) · 1.21 KB
/
serverless.js
File metadata and controls
56 lines (53 loc) · 1.21 KB
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
const functions = require('./serverless.functions');
const iamRoleStatements = require('./serverless.iamRoleStatements');
const {
AWS_ACCOUNT_ID,
AWS_REGION,
FUNCTION,
DOMAIN,
ENVIRONMENT = 'development',
OFFLINE_HOST,
OFFLINE_PORT,
SERVICE,
} = process.env;
const service = [SERVICE, FUNCTION].join('-');
const domainPrefix = ENVIRONMENT === 'development' ? ['dev'] : [];
const domainName = domainPrefix.concat(DOMAIN).join('-');
module.exports = {
service,
provider: {
name: 'aws',
runtime: 'nodejs8.10',
region: AWS_REGION,
stage: ENVIRONMENT,
environment: { ENVIRONMENT },
role: `arn:aws:iam::${AWS_ACCOUNT_ID}:role/${SERVICE}`,
iamRoleStatements,
apiName: service,
stackName: service,
},
plugins: [
'serverless-webpack',
'serverless-offline',
'serverless-domain-manager',
'serverless-aws-alias',
],
custom: {
'serverless-offline': {
host: OFFLINE_HOST,
port: OFFLINE_PORT,
},
customDomain: {
domainName,
basePath: FUNCTION,
stage: ENVIRONMENT,
},
webpack: {
includeModules: true,
packagerOptions: {
scripts: ['rm -rf node_modules/aws-sdk'],
},
},
},
functions,
};