code: function envReplace(str, vars) {
    return str.replace(/\$?\$\{([A-Za-z0-9_]+)(:-(.*?))?\}/g, function (varStr, varName, _, defValue) {
      // Handle escaping:
      if (varStr.indexOf('$$') === 0) {
        return varStr;
      }
      // Handle simple variable replacement:
      if (vars.hasOwnProperty(varName)) {
        log.debug(`${varName} replaced in configuration file`);
        return vars[varName];
      }
      // Handle default values:
      if (defValue) {
        log.debug(`${varName} replaced with default value in configuration file`);
        return defValue;
      }
      log.warn(`Unknown variable: ${varName}. Returning null.`);
      return null;
    });
  }
docs: Kindly borrowed from https://github.com/macbre/optimist-config-file/blob/master/lib/envvar-replace.js Thanks a lot guys 🙌