forked from shadowsocks/shadowsocks-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (28 loc) · 887 Bytes
/
server.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
if(process.env.NODE_ENV !== 'production' && +process.versions.node[0] < 8) {
console.log('use babel-core/register');
require('babel-core/register');
}
require('./init/log');
const log4js = require('log4js');
const logger = log4js.getLogger('system');
logger.info('System start.');
process.on('unhandledRejection', (reason, p) => {
logger.error('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
process.on('uncaughtException', (err) => {
logger.error(`Caught exception:`);
logger.error(err);
});
require('./init/utils');
require('./init/moveConfigFile');
require('./init/checkConfig');
require('./init/knex');
const initDb = require('./init/loadModels').init;
initDb().then(() => {
return require('./init/runShadowsocks').run();
}).then(() => {
require('./init/loadServices');
require('./init/loadPlugins');
}).catch(err => {
logger.error(err);
});