File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,14 @@ function getConfigFileName(param?: string) {
99}
1010
1111function getProps ( param ?: string ) {
12- if ( param ) {
13- return JSON . parse ( readFileSync ( join ( getConfigFileName ( param ) ) , 'utf8' ) ) ;
12+ try {
13+ if ( param ) {
14+ return JSON . parse ( readFileSync ( join ( getConfigFileName ( param ) ) , 'utf8' ) ) ;
15+ }
16+ return JSON . parse ( readFileSync ( join ( getConfigFileName ( ) ) , 'utf8' ) ) ;
17+ } catch ( err ) {
18+ return { } ;
1419 }
15- return JSON . parse ( readFileSync ( join ( getConfigFileName ( ) ) , 'utf8' ) ) ;
1620}
1721
1822const env = process . env . NODE_ENV || 'development' ;
@@ -45,9 +49,6 @@ const configurations = {
4549 } ,
4650} ;
4751
48- // tslint:disable-next-line:no-console
49- console . log ( env ) ;
50-
5152export default ( ) => ( {
5253 database : configurations [ env ] ,
5354} ) ;
Original file line number Diff line number Diff line change @@ -10,10 +10,14 @@ function getConfigFileName(param?: string) {
1010}
1111
1212function getProps ( param ?: string ) {
13- if ( param ) {
14- return dotenv . parse ( readFileSync ( join ( getConfigFileName ( param ) ) , 'utf8' ) ) ;
13+ try {
14+ if ( param ) {
15+ return dotenv . parse ( readFileSync ( join ( getConfigFileName ( param ) ) , 'utf8' ) ) ;
16+ }
17+ return dotenv . parse ( readFileSync ( join ( getConfigFileName ( ) ) , 'utf8' ) ) ;
18+ } catch ( err ) {
19+ return { } ;
1520 }
16- return dotenv . parse ( readFileSync ( join ( getConfigFileName ( ) ) , 'utf8' ) ) ;
1721}
1822
1923const env = process . env . NODE_ENV || 'development' ;
You can’t perform that action at this time.
0 commit comments