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.

24 lines
585 B

  1. const path = require('path')
  2. let WIKI = {
  3. IS_DEBUG: process.env.NODE_ENV === 'development',
  4. ROOTPATH: process.cwd(),
  5. SERVERPATH: path.join(process.cwd(), 'server'),
  6. Error: require('../helpers/error'),
  7. configSvc: require('./config')
  8. }
  9. global.WIKI = WIKI
  10. WIKI.configSvc.init()
  11. WIKI.logger = require('./logger').init('JOB')
  12. const args = require('yargs').argv
  13. ;(async () => {
  14. try {
  15. await require(`../jobs/${args.job}`)(args.data)
  16. process.exit(0)
  17. } catch (e) {
  18. await new Promise(resolve => process.stderr.write(e.message, resolve))
  19. process.exit(1)
  20. }
  21. })()