File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ const configure = () => {
20
20
21
21
if ( configData && configData . database ) {
22
22
logger . info ( `Using configuration from file: ${ filename } ` ) ;
23
- instance = configData ;
23
+ instance = configData ;
24
+ instance . keys = getKeys ( ) ;
24
25
return ;
25
26
}
26
27
}
@@ -39,7 +40,8 @@ const configure = () => {
39
40
user : envMysqlUser ,
40
41
password : process . env . DB_MYSQL_PASSWORD ,
41
42
name : envMysqlName ,
42
- }
43
+ } ,
44
+ keys : getKeys ( ) ,
43
45
} ;
44
46
return ;
45
47
}
@@ -56,23 +58,24 @@ const configure = () => {
56
58
} ,
57
59
useNullAsDefault : true
58
60
}
59
- }
61
+ } ,
62
+ keys : getKeys ( ) ,
60
63
} ;
64
+ } ;
61
65
66
+ const getKeys = ( ) => {
62
67
// Get keys from file
63
68
if ( ! fs . existsSync ( keysFile ) ) {
64
69
generateKeys ( ) ;
65
70
} else if ( process . env . DEBUG ) {
66
71
logger . info ( 'Keys file exists OK' ) ;
67
72
}
68
73
try {
69
- instance . keys = require ( keysFile ) ;
74
+ return require ( keysFile ) ;
70
75
} catch ( err ) {
71
76
logger . error ( 'Could not read JWT key pair from config file: ' + keysFile , err ) ;
72
77
process . exit ( 1 ) ;
73
78
}
74
-
75
- logger . debug ( 'Configuration: ' + JSON . stringify ( instance , null , 2 ) ) ;
76
79
} ;
77
80
78
81
const generateKeys = ( ) => {
You can’t perform that action at this time.
0 commit comments