Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #388 from ryanwarsaw/remove-new-relic
Browse files Browse the repository at this point in the history
Redundant dependency: newrelic
  • Loading branch information
ryanwarsaw committed Feb 24, 2017
2 parents b4cf6f4 + d0777dc commit c6d2632
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 34 deletions.
6 changes: 0 additions & 6 deletions README.md
Expand Up @@ -23,9 +23,3 @@ If you want to check your code passes before sending in a pull request (and ensu

* ensure that grunt is installed globally on your system - `npm install -g grunt`
* run `grunt --travis test`

## New Relic

To enable New Relic, set the `NEW_RELIC_ENABLED` environment variable and add a config file, or set the relevant environment variables.

For more information on configuring New Relic, see: https://github.com/newrelic/node-newrelic/#configuring-the-agent
4 changes: 2 additions & 2 deletions app/db/index.js
@@ -1,6 +1,6 @@
var Sequelize = require('sequelize');

module.exports = function (env, newrelic) {
module.exports = function (env) {
var sequelize;
var health = {
connected: false,
Expand All @@ -18,7 +18,7 @@ module.exports = function (env, newrelic) {
}

// Controllers
var modelControllers = require('./models')(sequelize, env, newrelic);
var modelControllers = require('./models')(sequelize, env);

// Sync
sequelize.sync().complete(function (err) {
Expand Down
14 changes: 7 additions & 7 deletions app/db/models/index.js
Expand Up @@ -7,7 +7,7 @@ var hatchet = require("hatchet");
var bcrypt = require("bcrypt");
var url = require("url");

module.exports = function (sequelize, env, newrelic) {
module.exports = function (sequelize, env) {
var TOKEN_EXPIRY_TIME = 1000 * 60 * 30;

var RESET_CODE_BIT_LENGTH = 256;
Expand Down Expand Up @@ -453,8 +453,8 @@ module.exports = function (sequelize, env, newrelic) {
changePassword: function (newPass, user, callback) {
var pass = user.password || password.build();

bcrypt.genSalt(BCRYPT_ROUNDS, newrelic.createTracer("bcrypt:genSalt", function (err, salt) {
bcrypt.hash(newPass, salt, newrelic.createTracer("bcrypt:hash", function (err, hash) {
bcrypt.genSalt(BCRYPT_ROUNDS, function (err, salt) {
bcrypt.hash(newPass, salt, function (err, hash) {
pass.saltedHash = hash;
user
.updateAttributes({
Expand All @@ -476,8 +476,8 @@ module.exports = function (sequelize, env, newrelic) {
error: "Login Database Error"
});
});
}));
}));
});
});
},

removePassword: function (user, callback) {
Expand All @@ -499,9 +499,9 @@ module.exports = function (sequelize, env, newrelic) {
},

compare: function (pass, user, callback) {
bcrypt.compare(pass, user.password.saltedHash, newrelic.createTracer("bcrypt:compare", function (err, res) {
bcrypt.compare(pass, user.password.saltedHash, function (err, res) {
callback(err, res);
}));
});
},

createOauthLogin: function (userId, clientId, callback) {
Expand Down
17 changes: 1 addition & 16 deletions app/http/server.js
Expand Up @@ -4,20 +4,6 @@

/* jshint node: true */

var newrelic;
if (process.env.NEW_RELIC_ENABLED) {
newrelic = require("newrelic");
} else {
newrelic = {
getBrowserTimingHeader: function () {
return "<!-- New Relic RUM disabled -->";
},
createTracer: function (name, handler) {
return handler;
}
};
}

module.exports = function (env) {
var express = require("express"),
helmet = require("helmet"),
Expand All @@ -27,7 +13,7 @@ module.exports = function (env) {
nunjucks = require("nunjucks"),
path = require("path"),
route = require("./routes"),
Models = require("../db")(env, newrelic).Models;
Models = require("../db")(env).Models;

var http = express(),
nunjucksEnv = new nunjucks.Environment([
Expand Down Expand Up @@ -88,7 +74,6 @@ module.exports = function (env) {
// audience and webmakerorg are duplicated because of i18n
AUDIENCE: env.get("WEBMAKERORG"),
WEBMAKERORG: env.get("WEBMAKERORG"),
newrelic: newrelic,
profile: env.get("PROFILE"),
bower_path: "bower_components",
personaHostname: env.get("PERSONA_HOSTNAME", "https://login.persona.org"),
Expand Down
1 change: 0 additions & 1 deletion app/http/views/site/account.html
Expand Up @@ -2,7 +2,6 @@
<html lang="{{ localeInfo.lang }}" dir="{{ localeInfo.direction }}">
<head>
<meta charset="utf-8">
{{ newrelic.getBrowserTimingHeader() | safe }}
<meta name="csrf-token" content="{{ csrf }}">
<title>Webmaker</title>
<link rel="stylesheet" href="/bower/font-awesome/css/font-awesome.min.css">
Expand Down
1 change: 0 additions & 1 deletion app/http/views/site/index.html
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<meta charset="utf-8">
{{ newrelic.getBrowserTimingHeader() | safe }}
<title>Webmaker SSO server</title>
<style>
p {
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -29,7 +29,6 @@
"less-middleware": "0.1.15",
"moment": "2.8.2",
"mysql": "2.0.1",
"newrelic": "^1.21.1",
"node-statsd": "0.0.7",
"nunjucks": "0.1.10",
"pass-test": "1.0.2",
Expand Down

0 comments on commit c6d2632

Please sign in to comment.