Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Issue 218 #14

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @version 1.0
*/
'use strict';
const config = require('config');
const _ = require('lodash');
const express = require('express');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
Expand Down Expand Up @@ -72,4 +74,37 @@ process.on('unhandledRejection', (err) => {
logger.logFullError(err, 'system');
});

// dump the configuration to logger
const ignoreConfigLog = ['cert', 'key', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET'];
/**
* Print configs to logger
* @param {Object} params the config params
* @param {Number} level the level of param object
*/
function dumpConfigs(params, level) {
Object.keys(params).forEach((key) => {
if (_.includes(ignoreConfigLog, key)) {
return;
}
const item = params[key];
let str = '';
let n = 0;
while (n < level) { // eslint-disable-line no-restricted-syntax
n++;
str += ' ';
}
if (item && _.isObject(item)) {
str += `${key}=`;
logger.debug(str);
dumpConfigs(item, level + 1);
} else {
str += `${key}=${item}`;
logger.debug(str);
}
});
}
logger.debug('--- List of Configurations ---');
dumpConfigs(config, 0);
logger.debug('--- End of List of Configurations ---');

module.exports = app;
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const fs = require('fs');

module.exports = {
PORT: process.env.PORT || 3000, // eslint-disable-line no-magic-numbers
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
TOPIC: process.env.TOPIC || 'tc-x-events',
KAFKA_OPTIONS: {
connectionString: process.env.KAFKA_URL || 'localhost:9092',
Expand Down