chore: configure angular and postgres foundation
This commit is contained in:
16
apps/api/src/database/data-source.ts
Normal file
16
apps/api/src/database/data-source.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'dotenv/config';
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const databaseUrl = process.env.DATABASE_URL;
|
||||
|
||||
if (!databaseUrl?.trim()) {
|
||||
throw new Error('DATABASE_URL is required');
|
||||
}
|
||||
|
||||
export const AppDataSource = new DataSource({
|
||||
type: 'postgres',
|
||||
url: databaseUrl,
|
||||
entities: [__dirname + '/../**/*.entity.{ts,js}'],
|
||||
migrations: [__dirname + '/migrations/*.{ts,js}'],
|
||||
synchronize: false,
|
||||
});
|
||||
Reference in New Issue
Block a user