import { ConnectionOptions } from 'typeorm' ; import * as path from 'path' ; require ( 'dotenv-flow' ) . config ( ) ; const databaseHost = process . env . DATABASE_HOST ; const databaseName = process . env . DATABASE_NAME ; const databasePort = Number ( process . env . DATABASE_PORT ) ; const databaseUsername = process . env . DATABASE_USERNAME ; const databasePassword = process . env . DATABASE_PASSWORD ; const synchronize = process . env . SYNC_DATABASE == 'true' ; const logging = process . env . NODE_ENV !== 'TEST' ; const config = { type : 'mysql' , multipleStatements : true , entities : [ path . resolve ( path . join ( __dirname ) ) + '/**/*.entity{.ts,.js}' ] , migrations : [ 'src/migration/*.ts' ] , migrationsRun : true , migrationsTableName : 'migration' , cli : { migrationsDir : 'src/migration' , } , host : databaseHost , database : databaseName , port : databasePort , username : databaseUsername , password : databasePassword , synchronize : synchronize || false , logging : logging , } ; export = config ;