This repository has been archived by the owner on Dec 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
register.js
60 lines (52 loc) · 1.65 KB
/
register.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict';
var path = require('path');
var workingDirectory = process.cwd();
var configFile = path.resolve(workingDirectory, 'config', 'newrelic');
var config = require(path.resolve(__dirname, configFile)).newrelic;
var env = process.env.NODE_ENV;
if (!env) {
env = 'development';
}
try {
var envFolderConfigFile = path.resolve(workingDirectory, 'config', 'env', env, 'newrelic');
var envFolderConfig = require(path.resolve(__dirname, envFolderConfigFile)).newrelic;
Object.assign(config, envFolderConfig);
} catch(e) {
/*
supress exception if file not found
otherwise sails won't load
*/
}
try {
var envConfigFile = path.resolve(workingDirectory, 'config', 'env', env);
var envConfig = require(path.resolve(__dirname, envConfigFile)).newrelic;
Object.assign(config, envConfig);
} catch(e) {
/*
supress exception if file not found
otherwise sails won't load
*/
}
try {
var localConfigFile = path.resolve(workingDirectory, 'config', 'local');
var localConfig = require(path.resolve(__dirname, localConfigFile)).newrelic;
Object.assign(config, localConfig);
} catch(e) {
/*
supress exception if file not found
otherwise sails won't load
*/
}
(function() {
global.newrelic = require('./lib/configurator')
.enabled(config.agent_enabled)
.name(config.app_name)
.key(config.license_key)
.proxy(config.proxy_host, config.proxy_port, config.proxy_user, config.proxy_pass, config.proxy)
.log(null, config.logging.level, config.rules.ignore)
.apdex(config.apdex_t)
.errors(config.error_collector)
.transactionTracer(config.transaction_tracer)
.slowSQL(config.slow_sql)
.setup();
}).call(this);