Permalink
Browse files

Include optional newrelic support by default

Also send cors headers on static font files and move most of the initial requires back into base of server/index.
  • Loading branch information...
davidkaneda committed Sep 7, 2014
1 parent 0626bd5 commit 654a643f6bfcc92af11cbb0e55cef34da642e340
Showing with 44 additions and 8 deletions.
  1. +2 −1 .gitignore
  2. +18 −0 newrelic.js
  3. +2 −0 package.json
  4. +17 −7 server/index.coffee
  5. +4 −0 server/routes/admin.coffee
  6. +1 −0 server/views/admin.hbs
View
@@ -4,4 +4,5 @@ bower_components
/public
node_modules
tmp
docs/api
docs/api
newrelic_agent.log
View
@@ -0,0 +1,18 @@
/**
* 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 = {
app_name: ['Buckets'],
license_key: process.env.NEW_RELIC_LICENSE_KEY,
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'
}
};
View
@@ -52,6 +52,7 @@
"compression": "^1.0.11",
"cookie-parser": "^1.3.1",
"cookie-session": "^1.0.2",
"cors": "^2.4.1",
"datejs": "^1.0.0-beta",
"express": "^4.2.0",
"glob": "^4.0.0",
@@ -97,6 +98,7 @@
"blanket": "*",
"chai": "*",
"mocha": "*",
"newrelic": "^1.11.0",
"rosie": "^0.3.1",
"sinon": "*",
"supertest": "*",
View
@@ -1,16 +1,26 @@
_ = require 'underscore'
hbs = require 'hbs'
colors = require 'colors'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
session = require 'cookie-session'
compression = require 'compression'
express = require 'express'
fs = require 'fs'
class Buckets
constructor: (config) ->
_ = require 'underscore'
baseConfig = require './config'
@config = baseConfig = _.extend baseConfig, config
express = require 'express'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
session = require 'cookie-session'
compression = require 'compression'
colors = require 'colors'
try
newrelicConfig = require '../newrelic'
if newrelicConfig.license_key
newrelic = require 'newrelic'
hbs.registerHelper 'newrelic', ->
new hbs.handlebars.SafeString newrelic.getBrowserTimingHeader()
passport = require './lib/auth'
@@ -1,5 +1,6 @@
express = require 'express'
hbs = require 'hbs'
cors = require 'cors'
glob = require 'glob'
fs = require 'fs'
favicon = require 'serve-favicon'
@@ -22,7 +23,10 @@ app.set 'views', "#{__dirname}/../views"
faviconFile = "#{__dirname}/../../public/favicon.ico"
app.use favicon faviconFile if fs.existsSync faviconFile
app.get '/*.(woff|ttf|eot|otf)', cors()
app.use express.static "#{__dirname}/../../public/", maxAge: 86400000 * 7 # One week
app.set 'plugins', plugins.load()
# Special case for install
View
@@ -2,6 +2,7 @@
<html class="no-js">
<head>
<meta charset="utf-8">
{{newrelic}}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Buckets</title>
<meta name="description" content="">

0 comments on commit 654a643

Please sign in to comment.