LocChat/server/database/config.ts
2021-12-04 21:14:01 -07:00

19 lines
482 B
TypeScript

import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import '../env';
export const config: TypeOrmModuleOptions =
process.env.NODE_ENV === 'development'
? {
type: 'postgres',
host: 'localhost',
port: 5432,
database: process.env.DATABASE_URL,
autoLoadEntities: true,
}
: {
type: 'postgres',
url: process.env.DATABASE_URL,
autoLoadEntities: true,
ssl: { rejectUnauthorized: false },
};