constants.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict'
  2. const fs = require('graceful-fs')
  3. const path = require('path')
  4. const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '/../package.json')).toString())
  5. exports.VERSION = pkg.version
  6. exports.DEFAULT_PORT = process.env.PORT || 9876
  7. exports.DEFAULT_HOSTNAME = process.env.IP || 'localhost'
  8. exports.DEFAULT_LISTEN_ADDR = process.env.LISTEN_ADDR || '0.0.0.0'
  9. // log levels
  10. exports.LOG_DISABLE = 'OFF'
  11. exports.LOG_ERROR = 'ERROR'
  12. exports.LOG_WARN = 'WARN'
  13. exports.LOG_INFO = 'INFO'
  14. exports.LOG_DEBUG = 'DEBUG'
  15. exports.LOG_LOG = 'LOG'
  16. exports.LOG_PRIORITIES = [
  17. exports.LOG_DISABLE,
  18. exports.LOG_ERROR,
  19. exports.LOG_WARN,
  20. exports.LOG_LOG,
  21. exports.LOG_INFO,
  22. exports.LOG_DEBUG
  23. ]
  24. // Default patterns for the pattern layout.
  25. exports.COLOR_PATTERN = '%[%d{DATE}:%p [%c]: %]%m'
  26. exports.NO_COLOR_PATTERN = '%d{DATE}:%p [%c]: %m'
  27. // Default console appender
  28. exports.CONSOLE_APPENDER = {
  29. type: 'console',
  30. layout: {
  31. type: 'pattern',
  32. pattern: exports.COLOR_PATTERN
  33. }
  34. }
  35. exports.EXIT_CODE = '\x1FEXIT'