This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
46 lines (38 loc) · 1.54 KB
/
index.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
/**
* Entry point for big-oauth2
*/
// Load console logging library
const log = require('./lib/logging-debug');
if (process.env.SENTRY) {//Check if user opted in
//Monitoring with sentry.io
log.info('Loading sentry for error and performance management for development');
const Sentry = require("@sentry/node");//Require sentry
// or use es6 import statements
// import * as Sentry from '@sentry/node';
const Tracing = require("@sentry/tracing");//Require performance tracing
// or use es6 import statements
// import * as Tracing from '@sentry/tracing';
Sentry.init({
dsn: "https://[email protected]/5588152",//public dsn
Integrations: [
new Sentry.Integrations.Http({ tracing: true }),
],
environment: 'git',
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,//Default performance tracing sample rate
});
}
// Provider loader
log.info('Loading OAuth2 provider modules');
try {
const requireDir = require('require-dir');//Module to make my life easier
var providers = requireDir('./providers');//Load all the providers
if (process.env.BIGOAUTH2_DEBUG) log.info('Providers were loaded')
} catch (e) {
log.error('Failed to load OAuth2 modules')//Error that providers failed to load
throw "Failed to load installed providers\n"+e//Throw error
}
if (process.env.BIGOAUTH2_TESTLOAD)
process.exit(0);
module.exports = providers;