File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,20 @@ export interface IConfig {
8
8
dbsslconn : boolean ;
9
9
jwtSecret : string ;
10
10
databaseUrl : string ;
11
+ dbEntitiesPath : ( Function | string ) [ ] ;
11
12
}
12
13
14
+ const isDevMode = process . env . NODE_ENV == 'development' ;
15
+
13
16
const config : IConfig = {
14
17
port : + process . env . PORT || 3000 ,
15
- debugLogging : process . env . NODE_ENV == 'development' ,
16
- dbsslconn : process . env . NODE_ENV != 'development' ,
18
+ debugLogging : isDevMode ,
19
+ dbsslconn : ! isDevMode ,
17
20
jwtSecret : process . env . JWT_SECRET || 'your-secret-whatever' ,
18
- databaseUrl : process . env . DATABASE_URL || 'postgres://user:pass@localhost:5432/apidb'
21
+ databaseUrl : process . env . DATABASE_URL || 'postgres://user:pass@localhost:5432/apidb' ,
22
+ dbEntitiesPath : [
23
+ ( 'dist/entity/**/*.js' ) || ( isDevMode && 'src/entity/**/*.ts' )
24
+ ]
19
25
} ;
20
26
21
27
export { config } ;
Original file line number Diff line number Diff line change @@ -28,9 +28,7 @@ createConnection({
28
28
database : connectionOptions . database ,
29
29
synchronize : true ,
30
30
logging : false ,
31
- entities : [
32
- 'dist/entity/**/*.js'
33
- ] ,
31
+ entities : config . dbEntitiesPath ,
34
32
extra : {
35
33
ssl : config . dbsslconn , // if not development, will use SSL
36
34
}
You can’t perform that action at this time.
0 commit comments