index.js 584 B

123456789101112131415161718
  1. 'use strict'
  2. import { CronJob } from 'cron'
  3. import server from './server'
  4. import { setup as cleanExtracts, extractsRemoverServiceLogger } from './cleanExtracts'
  5. import { imagesPath, deleteExtractsCronTime } from './config'
  6. const argv = process.argv.slice(2)
  7. // Start the extracts remover service
  8. if (!argv.includes('--no-delete')) { /* eslint no-new: 0 */
  9. new CronJob(deleteExtractsCronTime, () => cleanExtracts(imagesPath, false, true), null, true, null, null, false)
  10. extractsRemoverServiceLogger.info('Started the extracts remover service.')
  11. }
  12. // Start the server
  13. server()