@studyportals/sp-r2d2
Version:
A framework that contains various components used when developing projects that will be deployed via AWS λ.
28 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseEnvironmentVariablesProvider = void 0;
/**
* A basic implementation of the IEnvironmentVariablesProvider interface that fetches the values
* from the process.env global variable available from within an AWS Lambda method.
*/
class BaseEnvironmentVariablesProvider {
constructor() {
this.__i_environment_variables_provider__ = true;
}
get process() {
return process;
}
getEnvironmentVariables() {
return this.process.env;
}
get(variableName) {
const environmentVariables = this.getEnvironmentVariables();
const variableValue = environmentVariables[variableName];
if (undefined === variableValue) {
throw new Error(`The value of the '${variableName}' variable has not been set`);
}
return variableValue;
}
}
exports.BaseEnvironmentVariablesProvider = BaseEnvironmentVariablesProvider;
//# sourceMappingURL=base-environment-variables-provider.class.js.map