config.js 354 B

1234567891011121314151617181920
  1. 'use strict'
  2. const _ = require('lodash')
  3. module.exports = {
  4. /**
  5. * Parse configuration value for environment vars
  6. *
  7. * @param {any} cfg Configuration value
  8. * @returns Parse configuration value
  9. */
  10. parseConfigValue (cfg) {
  11. return _.replace(
  12. cfg,
  13. (/\$\([A-Z0-9_]+\)/g,
  14. (m) => { return process.env[m] })
  15. )
  16. }
  17. }