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.

56 lines
1.3 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. configSvc: require('./modules/config'),
  13. kernel: require('./modules/kernel')
  14. }
  15. global.wiki = wiki
  16. process.env.VIPS_WARNING = false
  17. // if (wiki.IS_DEBUG) {
  18. // require('@glimpse/glimpse').init()
  19. // }
  20. wiki.configSvc.init()
  21. // ----------------------------------------
  22. // Init Logger
  23. // ----------------------------------------
  24. wiki.logger = require('./modules/logger').init()
  25. // ----------------------------------------
  26. // Init Telemetry
  27. // ----------------------------------------
  28. wiki.telemetry = require('./modules/telemetry').init()
  29. process.on('unhandledRejection', (err) => {
  30. wiki.telemetry.sendError(err)
  31. })
  32. process.on('uncaughtException', (err) => {
  33. wiki.telemetry.sendError(err)
  34. })
  35. // ----------------------------------------
  36. // Init DB
  37. // ----------------------------------------
  38. wiki.db = require('./modules/db').init()
  39. // ----------------------------------------
  40. // Start Kernel
  41. // ----------------------------------------
  42. wiki.kernel.init()