Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* istanbul ignore if */
// production only
if (!runningDev) {
http.globalAgent.maxSockets = 500; // set this high, if you use httpClient or request anywhere (defaults to 5)
}
// development only
if (runningDev) {
app.use(expressErrorhandler());
app.locals.pretty = false;
}
if (runningLocal) {
// kill switch for CI
logger.warn('[express] Enabling kill switch for continueous integration.');
/* istanbul ignore next */
app.post('/kill', function(req, res) {
res.status(200).end();
process.exit(0);
});
}
// add the coverage handler
if (process.env.COVERAGE_ENABLED) {
//enable coverage endpoints under /coverage
app.use('/_coverage', require('istanbul-middleware').createHandler());
app.use('/coverage', express.static(path.resolve(__dirname, '../test/coverage/lcov-report'), { maxAge: 3600*24*30*1000 }));
}
};
connection.getConnectionOptions = function (postgres) {
postgres = postgres || nconf.get('postgres');
// Sensible defaults for PostgreSQL, if not set
if (!postgres.host) {
postgres.host = '127.0.0.1';
}
if (!postgres.port) {
postgres.port = 5432;
}
const dbName = postgres.database;
if (dbName === undefined || dbName === '') {
winston.warn('You have no database name, using "nodebb"');
postgres.database = 'nodebb';
}
var connOptions = {
host: postgres.host,
port: postgres.port,
user: postgres.username,
password: postgres.password,
database: postgres.database,
ssl: String(postgres.ssl) === 'true',
};
return _.merge(connOptions, postgres.options || {});
};
function createPool() {
winston.warn('Get database connection by new one');
const pool = mysql.createPool({
connectionLimit: 50,
acquireTimeout: 30000, // 30s
host: databaseConfiguration.dbHost,
port: databaseConfiguration.dbPort || databaseDefault.port,
database: databaseConfiguration.dbName || databaseDefault.database,
user: databaseConfiguration.dbUserID,
password: databaseConfiguration.dbUserPassword
});
pool.on('connection', function(){
winston.verbose('finish database connecting...');
});
pool.on('enqueue', function () {
function (rules, next) {
winston.verbose('[meta/blacklist] Loading ' + rules.valid.length + ' blacklist rule(s)' + (rules.duplicateCount > 0 ? ', ignored ' + rules.duplicateCount + ' duplicate(s)' : ''));
if (rules.invalid.length) {
winston.warn('[meta/blacklist] ' + rules.invalid.length + ' invalid blacklist rule(s) were ignored.');
}
Blacklist._rules = {
ipv4: rules.ipv4,
ipv6: rules.ipv6,
cidr: rules.cidr,
cidr6: rules.cidr6,
};
next();
},
], callback);
_.forEach(docs, function(doc) {
try {
var tags = parseTags(doc.content, doc.startingLine);
doc.tags = tags;
if ( tags.badTags.length > 0 ) {
log.warn(formatBadTagErrorMessage(doc));
}
} catch(e) {
log.error('Error parsing tags for doc starting at ' + doc.startingLine + ' in file ' + doc.file);
throw e;
}
});
}
db.createGalleryImageItem(mysql, params, function (err, result) {
if (err) {
req.flash('error', {msg: err});
winston.error(err);
return res.redirect('back');
}
winston.warn('Inserted gallery image:', result);
return res.redirect('back');
});
}
notificationsSchema.findAllForUser(request.user._id, function (err, data) {
if (err) {
winston.warn(err.message)
return callback(err)
}
return callback(null, data)
})
}
IEEE.prototype.search = function (query) {
var ieee = this
if (ieee.opts.xml) {
log.warn('The IEEE API does not provide fulltext XML, so the --xml flag will be ignored')
}
if (ieee.opts.pdf) {
log.warn('The IEEE API does not provide fulltext PDF links, so the --pdf flag will be ignored')
}
if (ieee.opts.minedterms) {
log.warn('The IEEE API does not provide mined terms, so the --minedterms flag will be ignored')
}
if (ieee.opts.supp) {
log.warn('The IEEE API does not provide supplementary materials, so the --supp flag will be ignored')
}
ieee.pagesize = 200
var options = {
hc: ieee.pagesize
}
if (!ieee.opts.all) {
options['oa'] = 1
return Promise.try(function() {
const type = file.getMimeCategory();
if (!processors[type]) {
logger.warn('[storage] No metadata parser for mime category "%s".', type);
return Promise.resolve();
}
return processors[type].metadata(file);
});
}
doc.renderedContent = doc.renderedContent.replace(INLINE_LINK, function(match, url, title) {
var linkInfo = partialNames.getLink(url, title);
if ( !linkInfo.valid ) {
log.warn('Error processing link "' + match + '" for "' + doc.id + '" in file "' + doc.file + '" at line ' + doc.startingLine + ':\n' + linkInfo.error);
}
return _.template('<a href="${url}">${title}</a>', linkInfo);
});
}