16 lines
460 B
TypeScript
16 lines
460 B
TypeScript
/**
|
|
* Checks if all environment variables are set
|
|
*
|
|
* @param variables the environment variables to check
|
|
* @returns true if all variables are set, false otherwise
|
|
*/
|
|
export function checkEnvironmentVariables(...variables: string[]): boolean {
|
|
let allVariablesSet = true;
|
|
variables.forEach((variable) => {
|
|
if (!process.env[variable]) {
|
|
throw new Error(`${variable} not set in environment variables`);
|
|
}
|
|
});
|
|
return allVariablesSet;
|
|
}
|