22 lines
590 B
TypeScript
22 lines
590 B
TypeScript
require('dotenv').config();
|
|
import 'reflect-metadata';
|
|
import { DataSource } from 'typeorm';
|
|
import config from 'config';
|
|
|
|
const postgresConfig = config.get<{
|
|
host: string;
|
|
port: number;
|
|
username: string;
|
|
password: string;
|
|
database: string;
|
|
}>('postgresConfig');
|
|
|
|
export const AppDataSource = new DataSource({
|
|
...postgresConfig,
|
|
type: 'postgres',
|
|
synchronize: false,
|
|
logging: false,
|
|
entities: ['server/entities/**/*.entity{.ts,.js}'],
|
|
migrations: ['server/migrations/**/*{.ts,.js}'],
|
|
// subscribers: ['server/subscribers/**/*{.ts,.js}'],
|
|
});
|