-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
46 lines (43 loc) · 1.21 KB
/
config.js
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
const bunyan = require('bunyan')
const pjs = require('./package.json')
const { name, version } = pjs
const getLogger = (serviceName, serviceVersion, level) =>
bunyan.createLogger({ name: `${serviceName}:${serviceVersion}`, level })
// Configuration options for different environments
module.exports = {
development: {
name,
version,
serviceTimeout: 30,
port: process.env.NODE_PORT,
postgres: {
host: process.env.DB_HOST,
user: process.env.DBUSER,
password: process.env.PASSWORD,
options: {
db: process.env.DB,
dialect: process.env.DB_DIALECT,
pool: {
max: parseInt(process.env.DB_POOL_MAX, 10),
min: parseInt(process.env.DB_POOL_MIN, 10),
acquire: parseInt(process.env.DB_POOL_ACQUIRE, 10),
idle: parseInt(process.env.DB_POOL_IDLE, 10),
},
logging: msg => getLogger(name, version, 'debug').info(msg),
},
},
log: () => getLogger(name, version, 'debug'),
},
production: {
name,
version,
serviceTimeout: 30,
log: () => getLogger(name, version, 'info'),
},
test: {
name,
version,
serviceTimeout: 30,
log: () => getLogger(name, version, 'fatal'),
},
}