config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict'
  2. import path from 'path'
  3. import winston from 'winston'
  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. // The directory where the images are stored
  13. export const imagesPath = TEST_MODE
  14. ? path.resolve(__dirname, 'test', 'images') // Used for automated testing, don't touch
  15. : process.env.IMAGES_PATH || path.resolve(__dirname, 'images')
  16. // Should the server serve client files from the `/dist` directory
  17. export const serveClient = process.env.SERVE_CLIENT === 'true' || true
  18. // File name convention for images
  19. export const fileNameConvention = /^(.*)?_([0-9]{2,})\.(.*)$/
  20. // Name of the directory containing extracts
  21. export const extractsDirName = 'extracts'
  22. // Files to ignore in scenes
  23. export const sceneFileNameBlackList = ['config', 'seuilExpe', extractsDirName]
  24. // Logger configuration
  25. export const logger = winston.createLogger({
  26. level: 'info',
  27. format: winston.format.json(),
  28. transports: [
  29. new winston.transports.File({ filename: 'logs/combined.log' }),
  30. new winston.transports.File({ filename: 'logs/error.log', level: 'error' }),
  31. new winston.transports.Console({
  32. level: 'debug',
  33. handleExceptions: true,
  34. format: winston.format.simple()
  35. })
  36. ],
  37. exitOnError: false
  38. })