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')
|
|
|
|
|
2017-07-23 03:56:46 +00:00
|
|
|
let wiki = {
|
|
|
|
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'),
|
2017-10-08 02:44:35 +00:00
|
|
|
configSvc: require('./modules/config'),
|
|
|
|
kernel: require('./modules/kernel')
|
2017-07-23 03:56:46 +00:00
|
|
|
}
|
|
|
|
global.wiki = wiki
|
2016-08-20 21:20:53 +00:00
|
|
|
|
2017-02-09 01:52:37 +00:00
|
|
|
process.env.VIPS_WARNING = false
|
|
|
|
|
2017-07-23 03:56:46 +00:00
|
|
|
// if (wiki.IS_DEBUG) {
|
2017-05-19 00:23:24 +00:00
|
|
|
// require('@glimpse/glimpse').init()
|
|
|
|
// }
|
2017-05-14 17:56:33 +00:00
|
|
|
|
2017-07-29 21:33:08 +00:00
|
|
|
wiki.configSvc.init()
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// Init Logger
|
|
|
|
// ----------------------------------------
|
|
|
|
|
|
|
|
wiki.logger = require('./modules/logger').init()
|
2017-03-29 00:19:01 +00:00
|
|
|
|
2017-10-23 01:58:07 +00:00
|
|
|
// ----------------------------------------
|
|
|
|
// Init Telemetry
|
|
|
|
// ----------------------------------------
|
|
|
|
|
|
|
|
wiki.telemetry = require('./modules/telemetry').init()
|
|
|
|
|
2017-10-29 05:30:46 +00:00
|
|
|
process.on('unhandledRejection', (err) => {
|
|
|
|
wiki.telemetry.sendError(err)
|
|
|
|
})
|
|
|
|
process.on('uncaughtException', (err) => {
|
|
|
|
wiki.telemetry.sendError(err)
|
|
|
|
})
|
|
|
|
|
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
|
|
|
// ----------------------------------------
|
|
|
|
|
2017-07-29 21:33:08 +00:00
|
|
|
wiki.db = require('./modules/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
|
|
|
|
2017-10-08 02:44:35 +00:00
|
|
|
wiki.kernel.init()
|