Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const c2k = require('koa-connect');
const logger = require('./logger/Logger').get();
const version = require('../version');
const Config = require('./Config');
Config.init();
const metrics = new MetricsMiddleware({ timeBuckets: [0.01, 0.05, 0.1, 0.5, 1, 5] });
const router = require('./Routes');
metrics.initBuildInfo(version.name, version.version, version.revision, version.buildTime);
logger.info(`Mira build info: ${JSON.stringify(version)}`);
logger.info(`Mira configuration: ${JSON.stringify(Config.getConfiguration())}`);
const app = new Koa();
const document = swagger.loadDocumentSync(path.join(__dirname, './../doc/api-doc.yml'));
let killOnNextLog = false;
if (Config.rollbarToken) {
const rollbar = new Rollbar({
accessToken: Config.rollbarToken,
});
logger.on('logged', (level, message) => {
if (Config.rollbarLevels.indexOf(level) > -1) {
rollbar.error(message, () => {
if (killOnNextLog) {
process.exit(1);
}
});
}