Files
parcer/server/src/utils/env.ts
2024-10-05 15:53:10 +05:30

8 lines
334 B
TypeScript

// Helper function to get environment variables and throw an error if they are not set
export const getEnvVariable = (key: string, defaultValue?: string): string => {
const value = process.env[key] || defaultValue;
if (!value) {
throw new Error(`Environment variable ${key} is not defined`);
}
return value;
};