()
| 3 | import { DataSource } from 'typeorm'; |
| 4 | |
| 5 | export function createDataSource(): DataSource { |
| 6 | return new DataSource({ |
| 7 | type: Config.getOrThrow('database.type', 'string') as any, |
| 8 | |
| 9 | url: Config.get('database.url', 'string'), |
| 10 | host: Config.get('database.host', 'string'), |
| 11 | port: Config.get('database.port', 'number'), |
| 12 | username: Config.get('database.username', 'string'), |
| 13 | password: Config.get('database.password', 'string'), |
| 14 | database: Config.get('database.database', 'string'), |
| 15 | |
| 16 | dropSchema: Config.get('database.dropSchema', 'boolean', false), |
| 17 | synchronize: Config.get('database.synchronize', 'boolean', false), |
| 18 | |
| 19 | entities: ['build/app/**/*.entity.js'], |
| 20 | migrations: ['build/migrations/*.js'], |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | export const dataSource = createDataSource(); |
no test coverage detected