chore: configure angular and postgres foundation
This commit is contained in:
16
apps/api/src/config/database.config.ts
Normal file
16
apps/api/src/config/database.config.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||
|
||||
export function createDatabaseConfig(
|
||||
databaseUrl: string,
|
||||
): TypeOrmModuleOptions {
|
||||
if (!databaseUrl.trim()) {
|
||||
throw new Error('DATABASE_URL is required');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'postgres',
|
||||
url: databaseUrl,
|
||||
autoLoadEntities: true,
|
||||
synchronize: false,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user