-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.base.ts
58 lines (55 loc) · 1.47 KB
/
serverless.base.ts
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
import type { Serverless } from 'serverless/aws';
import { env, envName } from './environments/environment.serverless';
console.log(`-------------- USING ENV: ${env.name} ----------------`);
export const baseServerlessConfigProvider: Serverless['provider'] = {
name: 'aws',
runtime: 'nodejs16.x',
memorySize: 128,
profile: env.profile,
stage: env.name,
environment: {
NODE_ENV: envName,
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
DB_PASSWORD: process.env['DB_PASSWORD'],
},
region: env.region,
};
export const baseServerlessConfig: Partial<Serverless> = {
frameworkVersion: '3',
service: 'base',
package: {
individually: true,
excludeDevDependencies: true
},
plugins: ['serverless-esbuild', 'serverless-offline', 'serverless-lift'],
custom: {
esbuild: {
bundle: true,
minify: env.name !== 'dev',
target: ['es2020'],
sourcemap: env.name !== 'dev',
sourcesContent: false,
plugins: '../../plugins.js',
define: { 'require.resolve': undefined },
exclude: ["pg-native"],
external: ["pg-native"]
},
localstack: {
stages: ["dev"]
}
},
provider: {
...baseServerlessConfigProvider,
apiGateway: {
minimumCompressionSize: 1024,
// @ts-ignore
restApiId: {
'Fn::ImportValue': `${env.name}-AppApiGW-restApiId`,
},
// @ts-ignore
restApiRootResourceId: {
'Fn::ImportValue': `${env.name}-AppApiGW-rootResourceId`,
},
},
},
};