-
Notifications
You must be signed in to change notification settings - Fork 6
/
knexfile.js
30 lines (28 loc) · 1.44 KB
/
knexfile.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
const env = require('./database-env')
module.exports = {
client: 'pg',
connection: env.PGURI,
searchPath: [env.PGSCHEMA, 'public'],
migrations: {
tableName: 'knex_migrations',
schemaName: env.PGSCHEMA,
},
pool: {
min: +process.env.KNEX_POOL_MIN || 0, // Minimum number of connections in the pool
max: +process.env.KNEX_POOL_MAX || 100, // Maximum number of connections in the pool
/*
Tarn.js configuration (see https://www.npmjs.com/package/tarn for more details)
Default tarn.js settings:
propagateCreateError: true // Whether to propagate errors encountered during creation
createRetryIntervalMillis: 200 // Delay between retries when trying to create a new connection
createTimeoutMillis: 30000 // Time to wait before timing out when creating a new connection
acquireTimeoutMillis: 30000 // Time to wait before timing out when acquiring a connection from the pool
reapIntervalMillis: 1000 // Frequency of checking for idle resources to be destroyed
*/
propagateCreateError: process.env.KNEX_POOL_PROPAGATE_CREATE_ERROR === 'true' || false,
createRetryIntervalMillis: +process.env.KNEX_POOL_CREATE_RETRY_INTERVAL_MILLIS || 200,
createTimeoutMillis: +process.env.KNEX_POOL_CREATE_TIMEOUT_MILLIS || 10000,
acquireTimeoutMillis: +process.env.KNEX_POOL_ACQUIRE_TIMEOUT_MILLIS || 10000,
reapIntervalMillis: +process.env.KNEX_POOL_REAP_INTERVAL_MILLIS || 500,
},
}