blog-be/ormconfig.js

23 lines
593 B
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const config = yaml.load(
fs.readFileSync(path.join(__dirname, './config.yml'), 'utf8'),
);
module.exports = {
type: 'postgres',
host: config.db.postgres.host,
port: config.db.postgres.port,
username: config.db.postgres.username,
password: config.db.postgres.password,
database: config.db.postgres.database,
migrations: ['migrations/**/*.ts'],
entities: ['src/**/*.entity.ts'],
cli: {
migrationsDir: 'migrations',
},
};