Source

utils/getEnvVar.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Helper to get environment variables with error throwing logic
 * @param name Name/key of the environment variable
 * @param isMandatory Whether it should throw an error if it's not defined. Default to true.
 * @category utils
 * @module getEnvVar
 */
var getEnvVar = function (name, isMandatory) {
    if (isMandatory === void 0) { isMandatory = true; }
    var value = process.env[name];
    if (isMandatory && value === undefined)
        throw new Error("".concat(name, " is required in environment but got undefined."));
    return value;
};
exports.default = getEnvVar;