config.js 990 B

12345678910111213141516171819202122232425262728293031323334
  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 port used by the server
  8. export const serverPort = parseInt(process.env.PORT, 10) || 5000
  9. // The directory where the images are stored (do not edit it)
  10. export const imagesPath = path.resolve(__dirname, 'images')
  11. // Should the server serve client files from the `/dist` directory
  12. export const serveClient = process.env.SERVE_CLIENT === 'true'
  13. // Logger configuration
  14. export const logger = winston.createLogger({
  15. level: 'info',
  16. format: winston.format.json(),
  17. transports: [
  18. new winston.transports.File({ filename: 'combined.log' }),
  19. new winston.transports.File({ filename: 'error.log', level: 'error' }),
  20. new winston.transports.Console({
  21. level: 'debug',
  22. handleExceptions: true,
  23. format: winston.format.simple()
  24. })
  25. ],
  26. exitOnError: false
  27. })