config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict'
  2. import path from 'path'
  3. import { logger, dbLogger } from './server/winston.config'
  4. export const PRODUCTION_MODE = process.env.NODE_ENV === 'production'
  5. export const TEST_MODE = process.env.NODE_ENV === 'test'
  6. // The url prefix for the API
  7. export const apiPrefix = '/api'
  8. // The url prefix from where the images are served
  9. export const imageServedUrl = apiPrefix + '/images'
  10. // The port used by the server
  11. export const serverPort = parseInt(process.env.PORT, 10) || 5000
  12. // MongoDB database connection URI
  13. export const mongoDatabaseURI = process.env.MONGO_URI || 'mongodb://localhost:27017/sin3d'
  14. // The directory where the images are stored
  15. export const imagesPath = TEST_MODE
  16. ? path.resolve(__dirname, 'test', 'images') // Used for automated testing, don't touch
  17. : process.env.IMAGES_PATH || path.resolve(__dirname, 'images')
  18. // Should the server serve client files from the `/dist` directory
  19. export const serveClient = process.env.SERVE_CLIENT === 'true' || true
  20. // File name convention for images
  21. export const fileNameConvention = /^(.*)?_([0-9]{2,})\.(.*)$/
  22. // Name of the directory containing extracts
  23. export const extractsDirName = 'extracts'
  24. // Files to ignore in scenes
  25. export const sceneFileNameBlackList = ['config', 'seuilExpe', extractsDirName]
  26. // Cron time for extracts deletion (every day at 03:00 AM)
  27. export const deleteExtractsCronTime = '0 3 * * *'
  28. // Logger configurations (Default application, WebSocket, Database)
  29. export { logger, dbLogger }