forked from auth0-extensions/auth0-account-link-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (36 loc) · 957 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
40
41
42
43
44
45
46
47
console.log("HI MICAH");
const nconf = require('nconf');
const path = require('path');
const logger = require('./lib/logger');
logger.info("LOG MICAH");
nconf
.argv()
.env()
.file(path.join(__dirname, './server/config.json'))
.defaults({
AUTH0_RTA: 'auth0.auth0.com',
DATA_CACHE_MAX_AGE: 1000 * 10,
NODE_ENV: 'development',
HOSTING_ENV: 'default',
PORT: 3000,
USE_OAUTH2: false,
LOG_COLOR: true
});
const createServer = require('./server/init');
const startServer = server =>
new Promise((resolve, reject) => {
server.start((err) => {
if (err) {
reject(err);
}
resolve(server);
logger.info(`Server running at: ${server.info.uri}`);
});
});
const server = createServer(key => nconf.get(key), null);
startServer(server).catch((err) => {
logger.error(err);
logger.error('Server could not be started. Aborting...');
process.exit(1);
});
module.exports = server;