wikijs-fork/server/index.js

56 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-08-17 00:56:55 +00:00
// ===========================================
// Wiki.js
2016-08-17 00:56:55 +00:00
// Licensed under AGPLv3
// ===========================================
const path = require('path')
2017-07-29 21:33:08 +00:00
const cluster = require('cluster')
let wiki = {
IS_DEBUG: process.env.NODE_ENV === 'development',
2017-07-29 21:33:08 +00:00
IS_MASTER: cluster.isMaster,
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'),
configSvc: require('./core/config'),
kernel: require('./core/kernel')
}
global.wiki = wiki
// if (wiki.IS_DEBUG) {
2017-05-19 00:23:24 +00:00
// require('@glimpse/glimpse').init()
// }
2017-07-29 21:33:08 +00:00
wiki.configSvc.init()
// ----------------------------------------
// Init Logger
// ----------------------------------------
wiki.logger = require('./core/logger').init()
2017-03-29 00:19:01 +00:00
2017-10-23 01:58:07 +00:00
// ----------------------------------------
// Init Telemetry
// ----------------------------------------
wiki.telemetry = require('./core/telemetry').init()
2017-10-23 01:58:07 +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
// ----------------------------------------
wiki.db = require('./core/db').init()
2016-08-17 00:56:55 +00:00
// ----------------------------------------
2017-10-08 02:44:35 +00:00
// Start Kernel
// ----------------------------------------
2017-10-08 02:44:35 +00:00
wiki.kernel.init()