proxy/packages/utils/src/envVariables.ts
2023-11-14 17:56:44 +00:00

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;
}