forked from auth0-extensions/auth0-sso-dashboard-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (34 loc) · 897 Bytes
/
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
const path = require('path');
const nconf = require('nconf');
const logger = require('./server/lib/logger');
// Initialize babel.
require('babel-core/register')({
ignore: /node_modules/,
sourceMaps: !(process.env.NODE_ENV === 'production')
});
require('babel-polyfill');
// Handle uncaught.
process.on('uncaughtException', (err) => {
logger.error(err);
});
// Initialize configuration.
nconf
.argv()
.env()
.file(path.join(__dirname, './server/config.json'))
.defaults({
DATA_CACHE_MAX_AGE: 1000 * 10,
NODE_ENV: 'development',
HOSTING_ENV: 'default',
PORT: 3001,
TITLE: 'SSO Dashboard'
});
// Start the server.
const app = require('./server')((key) => nconf.get(key), null);
app.listen(nconf.get('PORT'), (error) => {
if (error) {
logger.error(error);
} else {
logger.info(`Express listening on http://localhost:${nconf.get('PORT')}`);
}
});