forked from jsdelivr/globalping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknexfile.js
33 lines (30 loc) · 805 Bytes
/
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
31
32
33
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import _ from 'lodash';
import config from 'config';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const dbConfig = config.get('db');
/**
* @typedef {import('knex').Knex.Config} KnexConfig
* @type {{ [key: string]: KnexConfig }}
*/
export default _.merge({}, ...[ 'development', 'production', 'staging', 'test' ].map((environment) => {
return {
[environment]: {
client: dbConfig.type,
connection: dbConfig.connection,
pool: {
min: 0,
max: 10,
propagateCreateError: false,
},
acquireConnectionTimeout: 10000,
seeds: {
directory: path.join(__dirname, `./seeds/${environment}`),
},
migrations: {
directory: path.join(__dirname, `./migrations`),
},
},
};
}));