@@ -2,38 +2,18 @@ import { ConfigService } from '@nestjs/config';
22import { TypeOrmModuleOptions } from '@nestjs/typeorm' ;
33import { SnakeNamingStrategy } from 'typeorm-naming-strategies' ;
44
5- export const typeormConfig =
6- process . env . NODE_ENV === 'dev'
7- ? {
8- useFactory : async (
9- configService : ConfigService
10- ) : Promise < TypeOrmModuleOptions > => ( {
11- type : 'mysql' ,
12- host : 'localhost' ,
13- port : 3306 ,
14- username : configService . get ( 'DB_USER' ) ,
15- password : configService . get ( 'DB_PASSWORD' ) ,
16- database : configService . get ( 'DB_NAME' ) ,
17- entities : [ __dirname + '/../**/*.entity.{ts,js}' ] ,
18- logging : [ 'query' , 'error' ] ,
19- synchronize : true ,
20- namingStrategy : new SnakeNamingStrategy ( ) ,
21- } ) ,
22- inject : [ ConfigService ] ,
23- }
24- : {
25- useFactory : async (
26- configService : ConfigService
27- ) : Promise < TypeOrmModuleOptions > => ( {
28- type : 'mysql' ,
29- host : 'localhost' ,
30- port : 3306 ,
31- username : process . env . DB_USER ,
32- password : process . env . DB_PASSWORD ,
33- database : process . env . DB_NAME ,
34- entities : [ __dirname + '/../**/*.entity.{ts,js}' ] ,
35- logging : [ ] ,
36- synchronize : true ,
37- } ) ,
38- inject : [ ConfigService ] ,
39- } ;
5+ export const typeormConfig = {
6+ useFactory : async ( configService : ConfigService ) : Promise < TypeOrmModuleOptions > => ( {
7+ type : 'mysql' ,
8+ host : 'localhost' ,
9+ port : 3306 ,
10+ username : configService . get ( 'DB_USER' ) ,
11+ password : configService . get ( 'DB_PASSWORD' ) ,
12+ database : configService . get ( 'DB_NAME' ) ,
13+ entities : [ __dirname + '/../**/*.entity.{ts,js}' ] ,
14+ logging : [ 'query' , 'error' ] ,
15+ synchronize : true ,
16+ namingStrategy : new SnakeNamingStrategy ( ) ,
17+ } ) ,
18+ inject : [ ConfigService ] ,
19+ } ;
0 commit comments