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.

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