25 lines
605 B
TypeScript
25 lines
605 B
TypeScript
import dotenv from 'dotenv';
|
|
import path from 'path';
|
|
|
|
// Enforce loading the .env from the knexfile directory (project root)
|
|
dotenv.config({ path: path.join(__dirname, '.env') });
|
|
|
|
const config = {
|
|
client: 'pg',
|
|
connection: {
|
|
host: process.env.DB_HOST,
|
|
port: parseInt(process.env.DB_PORT || '5432', 10),
|
|
user: process.env.DB_USER,
|
|
password: process.env.DB_PASSWORD,
|
|
database: process.env.DB_NAME,
|
|
},
|
|
pool: { min: 2, max: 10 },
|
|
migrations: {
|
|
directory: './src/database/migrations',
|
|
tableName: 'knex_migrations'
|
|
}
|
|
};
|
|
|
|
export default config;
|
|
module.exports = config;
|