first commit
This commit is contained in:
23
myteamwallet_backend/src/database/data-source.ts
Normal file
23
myteamwallet_backend/src/database/data-source.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'reflect-metadata';
|
||||
import { DataSource, DataSourceOptions } from 'typeorm';
|
||||
|
||||
export const AppDataSource = new DataSource({
|
||||
type: process.env.DATABASE_TYPE,
|
||||
url: process.env.DATABASE_URL,
|
||||
host: process.env.DATABASE_HOST,
|
||||
port: parseInt(process.env.DATABASE_PORT, 10) || 5432,
|
||||
username: process.env.DATABASE_USERNAME,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
synchronize: process.env.DATABASE_SYNCHRONIZE === 'true',
|
||||
dropSchema: false,
|
||||
keepConnectionAlive: true,
|
||||
logging: process.env.NODE_ENV !== 'production',
|
||||
entities: [__dirname + '/../**/*.entity{.ts,.js}'],
|
||||
migrations: [__dirname + '/migrations/**/*{.ts,.js}'],
|
||||
cli: {
|
||||
entitiesDir: 'src',
|
||||
migrationsDir: 'src/database/migrations',
|
||||
subscribersDir: 'subscriber',
|
||||
},
|
||||
} as DataSourceOptions);
|
||||
Reference in New Issue
Block a user