@@ -148,6 +148,50 @@ process.on('unhandledRejection', (err) => {
148
148
logger . logFullError ( err , 'system' ) ;
149
149
} ) ;
150
150
151
+ // dump the configuration to logger
152
+ const ignoreConfigLog = [
153
+ 'cert' ,
154
+ 'key' ,
155
+ 'AWS_ACCESS_KEY_ID' ,
156
+ 'AWS_SECRET_ACCESS_KEY' ,
157
+ 'AUTH0_CLIENT_ID' ,
158
+ 'AUTH0_CLIENT_SECRET' ,
159
+ 'GITHUB_CLIENT_ID' ,
160
+ 'GITHUB_CLIENT_SECRET' ,
161
+ 'GITLAB_CLIENT_ID' ,
162
+ 'GITLAB_CLIENT_SECRET'
163
+ ] ;
164
+ /**
165
+ * Print configs to logger
166
+ * @param {Object } params the config params
167
+ * @param {Number } level the level of param object
168
+ */
169
+ function dumpConfigs ( params , level ) {
170
+ Object . keys ( params ) . forEach ( ( key ) => {
171
+ if ( _ . includes ( ignoreConfigLog , key ) ) {
172
+ return ;
173
+ }
174
+ const item = params [ key ] ;
175
+ let str = '' ;
176
+ let n = 0 ;
177
+ while ( n < level ) { // eslint-disable-line no-restricted-syntax
178
+ n ++ ;
179
+ str += ' ' ;
180
+ }
181
+ if ( item && _ . isObject ( item ) ) {
182
+ str += `${ key } =` ;
183
+ logger . debug ( str ) ;
184
+ dumpConfigs ( item , level + 1 ) ;
185
+ } else {
186
+ str += `${ key } =${ item } ` ;
187
+ logger . debug ( str ) ;
188
+ }
189
+ } ) ;
190
+ }
191
+ logger . debug ( '--- List of Configurations ---' ) ;
192
+ dumpConfigs ( config , 0 ) ;
193
+ logger . debug ( '--- End of List of Configurations ---' ) ;
194
+
151
195
const port = config . PORT ;
152
196
app . listen ( port , '0.0.0.0' ) ;
153
197
logger . info ( 'Topcoder X server listening on port %d' , port ) ;
0 commit comments