generated from sudokar/nx-serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.common.ts
50 lines (47 loc) · 1015 Bytes
/
serverless.common.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
import type { Serverless } from 'serverless/aws';
export type Service = 'public-api' | 'background-jobs' | 'example-service';
export type Port = {
httpPort: number;
lambdaPort: number;
};
type PortConfig = {
[k in Service]: Port;
};
export const PORTS: PortConfig = {
'public-api': {
httpPort: 3000,
lambdaPort: 3002,
},
'background-jobs': {
httpPort: 3004,
lambdaPort: 3006,
},
'example-service': {
httpPort: 3008,
lambdaPort: 3010,
},
};
export const getCustomConfig = (
serviceName: Service
): Serverless['custom'] => ({
'serverless-offline': {
httpPort: PORTS[serviceName].httpPort,
lambdaPort: PORTS[serviceName].lambdaPort,
},
esbuild: {
packager: 'yarn',
plugins: '../../esbuild-plugins.js',
bundle: true,
minify: true,
sourcemap: true,
},
'serverless-offline-sqs': {
autoCreate: true,
apiVersion: '2012-11-05',
endpoint: 'http://0.0.0.0:9324',
region: 'us-east-1',
accessKeyId: 'root',
secretAccessKey: 'root',
skipCacheInvalidation: false,
},
});