From f4d66c738492365ff821cca0141c860eff73a3fe Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sun, 21 Feb 2016 22:30:25 +0100 Subject: [PATCH] config newrelic --- newrelic.js | 27 +++++++++++++++++++++++++++ website/src/libs/utils.js | 2 -- website/src/server.js | 3 +++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 newrelic.js diff --git a/newrelic.js b/newrelic.js new file mode 100644 index 0000000000..5f60463bb5 --- /dev/null +++ b/newrelic.js @@ -0,0 +1,27 @@ +var nconf = require('nconf'); + +/** + * New Relic agent configuration. + * + * See lib/config.defaults.js in the agent distribution for a more complete + * description of configuration variables and their potential values. + */ +exports.config = { + /** + * Array of application names. + */ + app_name: ['Habitica'], + /** + * Your New Relic license key. + */ + license_key: nconf.get('NEW_RELIC_LICENSE_KEY'), + ssl: false, + logging: { + /** + * Level at which to log. 'trace' is most useful to New Relic when diagnosing + * issues with the agent, 'info' and higher will impose the least overhead on + * production applications. + */ + level: 'info' + } +} diff --git a/website/src/libs/utils.js b/website/src/libs/utils.js index 13cb5e6982..8faa8a6423 100644 --- a/website/src/libs/utils.js +++ b/website/src/libs/utils.js @@ -174,8 +174,6 @@ module.exports.setupConfig = function(){ if (nconf.get('NODE_ENV') === "development") Error.stackTraceLimit = Infinity; - if (nconf.get('NODE_ENV') === 'production') - require('newrelic'); isProd = nconf.get('NODE_ENV') === 'production'; baseUrl = nconf.get('BASE_URL'); diff --git a/website/src/server.js b/website/src/server.js index 7040d82c3d..1ae2591339 100644 --- a/website/src/server.js +++ b/website/src/server.js @@ -21,6 +21,9 @@ if (cores!==0 && cluster.isMaster && (isDev || isProd)) { }); } else { + if (nconf.get('NODE_ENV') === 'production') + require('newrelic'); + var express = require("express"); var http = require("http"); var path = require("path");