config.js 357 Bytes
Newer Older
NGPixel's avatar
NGPixel committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
'use strict'

const _ = require('lodash')

module.exports = {
  /**
   * Parse configuration value for environment vars
   *
   * @param {any} cfg Configuration value
   * @returns Parse configuration value
   */
  parseConfigValue (cfg) {
    return _.replace(
      cfg,
NGPixel's avatar
NGPixel committed
15 16
      /\$\(([A-Z0-9_]+)\)/g,
      (fm, m) => { return process.env[m] }
NGPixel's avatar
NGPixel committed
17 18 19
    )
  }
}