2016-08-17 00:56:55 +00:00
|
|
|
// ===========================================
|
2016-12-09 03:44:31 +00:00
|
|
|
// Wiki.js
|
2016-08-17 00:56:55 +00:00
|
|
|
// Licensed under AGPLv3
|
|
|
|
// ===========================================
|
|
|
|
|
2017-04-28 21:58:38 +00:00
|
|
|
const path = require('path')
|
2017-07-29 21:33:08 +00:00
|
|
|
const cluster = require('cluster')
|
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
let WIKI = {
|
2017-07-23 03:56:46 +00:00
|
|
|
IS_DEBUG: process.env.NODE_ENV === 'development',
|
2017-07-29 21:33:08 +00:00
|
|
|
IS_MASTER: cluster.isMaster,
|
2017-07-23 03:56:46 +00:00
|
|
|
ROOTPATH: process.cwd(),
|
2017-07-29 21:33:08 +00:00
|
|
|
SERVERPATH: path.join(process.cwd(), 'server'),
|
2018-01-10 01:41:53 +00:00
|
|
|
Error: require('./helpers/error'),
|
2018-02-04 05:53:13 +00:00
|
|
|
configSvc: require('./core/config'),
|
|
|
|
kernel: require('./core/kernel')
|
2017-07-23 03:56:46 +00:00
|
|
|
}
|
2018-03-05 20:49:36 +00:00
|
|
|
global.WIKI = WIKI
|
2016-08-20 21:20:53 +00:00
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.configSvc.init()
|
2017-07-29 21:33:08 +00:00
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// Init Logger
|
|
|
|
// ----------------------------------------
|
|
|
|
|
2018-04-29 21:55:36 +00:00
|
|
|
WIKI.logger = require('./core/logger').init('MASTER')
|
2017-03-29 00:19:01 +00:00
|
|
|
|
2017-10-23 01:58:07 +00:00
|
|
|
// ----------------------------------------
|
|
|
|
// Init Telemetry
|
|
|
|
// ----------------------------------------
|
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.telemetry = require('./core/telemetry').init()
|
2017-10-23 01:58:07 +00:00
|
|
|
|
2017-10-29 05:30:46 +00:00
|
|
|
process.on('unhandledRejection', (err) => {
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.telemetry.sendError(err)
|
2017-10-29 05:30:46 +00:00
|
|
|
})
|
|
|
|
process.on('uncaughtException', (err) => {
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.telemetry.sendError(err)
|
2017-10-29 05:30:46 +00:00
|
|
|
})
|
|
|
|
|
2016-08-17 00:56:55 +00:00
|
|
|
// ----------------------------------------
|
2017-07-29 21:33:08 +00:00
|
|
|
// Init DB
|
2016-08-17 00:56:55 +00:00
|
|
|
// ----------------------------------------
|
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.db = require('./core/db').init()
|
2016-08-17 00:56:55 +00:00
|
|
|
|
2016-09-25 04:08:49 +00:00
|
|
|
// ----------------------------------------
|
2017-10-08 02:44:35 +00:00
|
|
|
// Start Kernel
|
2016-09-25 04:08:49 +00:00
|
|
|
// ----------------------------------------
|
2016-08-22 03:18:31 +00:00
|
|
|
|
2018-03-05 20:49:36 +00:00
|
|
|
WIKI.kernel.init()
|