feat: Convert ts files to js files for config folder

This commit is contained in:
Faruk AYDIN
2023-12-28 13:09:24 +01:00
parent fd0b12f6a1
commit ca7b8b865a
5 changed files with 4 additions and 65 deletions

View File

@@ -0,0 +1,22 @@
import process from 'process';
// The following two lines are required to get count values as number.
// More info: https://github.com/knex/knex/issues/387#issuecomment-51554522
import pg from 'pg';
pg.types.setTypeParser(20, 'text', parseInt);
import knex from 'knex';
import knexConfig from '../../knexfile';
import logger from '../helpers/logger';
export const client = knex(knexConfig);
const CONNECTION_REFUSED = 'ECONNREFUSED';
client.raw('SELECT 1').catch((err) => {
if (err.code === CONNECTION_REFUSED) {
logger.error(
'Make sure you have installed PostgreSQL and it is running.',
err
);
process.exit();
}
});