Dyanmic NewRelice API keys in NodeJS
• Mark Eschbach
Well, after racking my brian and trying a few different things, NewRelic still isn’t happy. Turns out you need a file in your root repository called newrelic.js
. If I had read the manual it would have saved me a great deal of time. So the on disk configuration looks something like the following.
exports.config = {
app_name: ['node-app']
}
During initialization thie module is included first. The app_name
is overriden and the licese key is injected. For example:
let nr_config_module = require( './newrelic' )
nr_config_module.config.license_key = nr_key
nr_config_module.config.app_name = [ "some-application-name" ]
let nr = require('newrelic')
This will configure NewRelic.