config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict'
  2. import path from 'path'
  3. import winston from 'winston'
  4. export const PRODUCTION_MODE = process.env.NODE_ENV === 'production'
  5. // The url prefix for the API
  6. export const apiPrefix = '/api'
  7. // The url prefix from where the images are served
  8. export const imageServedUrl = apiPrefix + '/images'
  9. // The port used by the server
  10. export const serverPort = parseInt(process.env.PORT, 10) || 5000
  11. // The directory where the images are stored
  12. export const imagesPath = process.env.IMAGES_PATH || path.resolve(__dirname, 'images')
  13. // Should the server serve client files from the `/dist` directory
  14. export const serveClient = process.env.SERVE_CLIENT === 'true' || true
  15. // File name convention for images
  16. export const fileNameConvention = /^(.*)?_([0-9]{2,})\.(.*)$/
  17. // Files to ignore in scenes
  18. export const sceneFileNameBlackList = ['config', 'seuilExpe', 'extracts']
  19. // Name of the directory containing extracts
  20. export const extractsDirName = 'extracts'
  21. // Logger configuration
  22. export const logger = winston.createLogger({
  23. level: 'info',
  24. format: winston.format.json(),
  25. transports: [
  26. new winston.transports.File({ filename: 'logs/combined.log' }),
  27. new winston.transports.File({ filename: 'logs/error.log', level: 'error' }),
  28. new winston.transports.Console({
  29. level: 'debug',
  30. handleExceptions: true,
  31. format: winston.format.simple()
  32. })
  33. ],
  34. exitOnError: false
  35. })