You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

  1. // ===========================================
  2. // Wiki.js
  3. // Licensed under AGPLv3
  4. // ===========================================
  5. const path = require('path')
  6. const cluster = require('cluster')
  7. let WIKI = {
  8. IS_DEBUG: process.env.NODE_ENV === 'development',
  9. IS_MASTER: cluster.isMaster,
  10. ROOTPATH: process.cwd(),
  11. SERVERPATH: path.join(process.cwd(), 'server'),
  12. Error: require('./helpers/error'),
  13. configSvc: require('./core/config'),
  14. kernel: require('./core/kernel')
  15. }
  16. global.WIKI = WIKI
  17. WIKI.configSvc.init()
  18. // ----------------------------------------
  19. // Init Logger
  20. // ----------------------------------------
  21. WIKI.logger = require('./core/logger').init('MASTER')
  22. // ----------------------------------------
  23. // Init Telemetry
  24. // ----------------------------------------
  25. WIKI.telemetry = require('./core/telemetry').init()
  26. process.on('unhandledRejection', (err) => {
  27. WIKI.telemetry.sendError(err)
  28. })
  29. process.on('uncaughtException', (err) => {
  30. WIKI.telemetry.sendError(err)
  31. })
  32. // ----------------------------------------
  33. // Init DB
  34. // ----------------------------------------
  35. WIKI.db = require('./core/db').init()
  36. // ----------------------------------------
  37. // Start Kernel
  38. // ----------------------------------------
  39. WIKI.kernel.init()