This repository was archived by the owner on Jul 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.ts
More file actions
100 lines (83 loc) · 2.74 KB
/
serverless.ts
File metadata and controls
100 lines (83 loc) · 2.74 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
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
import type { AWS } from '@serverless/typescript'
import { isStage } from 'utils/serverless-helpers'
import { name } from './package.json'
import functions from '~/functions'
const config: AWS = {
service: name,
frameworkVersion: '2',
unresolvedVariablesNotificationMode: 'error',
configValidationMode: 'error',
useDotenv: true,
variablesResolutionMode: '20210326',
plugins: [
'serverless-bundle',
'serverless-domain-manager',
'serverless-certificate-creator',
'serverless-offline',
],
custom: {
baseDomain: '${env:DOMAIN, "domain.local"}',
domain: '${opt:domain, "${self:provider.stage}.${self:custom.baseDomain}"}', // dev.domain.com
customCertificate: {
certificateName: '*.${self:custom.baseDomain}', // *.domain.com
hostedZoneNames: '${self:custom.baseDomain}.', // domain.com.
region: '${self:provider.region}',
},
customDomain: {
region: '${self:provider.region}',
domainName: '${self:custom.domain}',
certificateName: '${self:custom.customCertificate.certificateName}',
basePath: '',
endpointType: 'regional',
stage: '${self:provider.stage}',
createRoute53Record: true,
},
bundle: {
sourcemaps: true,
caching: true,
stats: true,
linting: false,
forceInclude: ['knex', 'pg'],
ignorePackages: ['pg-native'],
aliases: [{ '@libs': 'src/libs' }, { '~': 'src' }, { '~types': 'types' }],
},
dbConfig: !isStage('local')
? '${ssm:/aws/reference/secretsmanager/rds-config-${self:service}infra-${self:provider.stage}, null}'
: {
DATABASE_NAME: '${env:DB_NAME}',
DATABASE_USER: '${env:DB_USER}',
DATABASE_PASS: '${env:DB_PASSWORD}',
DATABASE_HOST: '${env:DB_HOST}',
},
},
package: {
individually: true,
},
provider: {
name: 'aws',
runtime: 'nodejs14.x',
endpointType: 'regional',
// @ts-ignore
region: '${opt:region, "eu-central-1"}',
stage: '${opt:stage, "dev"}',
stackName: '${self:service}--${self:provider.stage}',
apiName: '${self:service}--${self:provider.stage}',
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
DB_NAME: '${self:custom.dbConfig.DATABASE_NAME}',
DB_USER: '${self:custom.dbConfig.DATABASE_USER}',
DB_PASSWORD: '${self:custom.dbConfig.DATABASE_PASS}',
DB_HOST:
'${self:custom.dbConfig.DATABASE_HOST, ssm:/rds-url-${self:service}infra-${self:provider.stage}}',
DB_PORT: '${env:DB_PORT, 5432}',
JWT_SECRET: '${env:JWT_SECRET, "dontdothistome"}',
},
lambdaHashingVersion: '20201221',
},
functions,
}
module.exports = config