diff --git a/newrelic.js b/newrelic.js index 7763ba2269..682f608e42 100644 --- a/newrelic.js +++ b/newrelic.js @@ -20,6 +20,6 @@ exports.config = { * issues with the agent, 'info' and higher will impose the least overhead on * production applications. */ - level : 'trace' + level : 'warning' } }; diff --git a/src/server.js b/src/server.js index 0dec3210ac..fb76862fad 100644 --- a/src/server.js +++ b/src/server.js @@ -1,5 +1,6 @@ -// Only do the minimal amount of work before forking just in case of a dyno restart var nconf = require('nconf'); +var utils = require('./utils'); +utils.setupConfig(); require('coffee-script') // remove this once we've fully converted over var express = require("express"); @@ -8,18 +9,12 @@ var path = require("path"); var domainMiddleware = require('domain-middleware'); var swagger = require("swagger-node-express"); -var utils = require('./utils'); var middleware = require('./middleware'); var TWO_WEEKS = 1000 * 60 * 60 * 24 * 14; var app = express(); var server; -// ------------ Setup configurations ------------ -utils.setupConfig(); -if (nconf.get('NODE_ENV') === 'production') - require('newrelic'); - // ------------ MongoDB Configuration ------------ mongoose = require('mongoose'); require('./models/user'); //load up the user schema - TODO is this necessary? diff --git a/src/utils.js b/src/utils.js index 791ba3c57c..e903b3b91c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -56,6 +56,7 @@ module.exports.setupConfig = function(){ if (nconf.get('NODE_ENV') === "development") { Error.stackTraceLimit = Infinity; } + if (nconf.get('NODE_ENV') === 'production') require('newrelic'); };