17 lines
341 B
TypeScript
17 lines
341 B
TypeScript
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,
|
|
};
|
|
}
|