Add getEnvVar.ts to convert env vars to appropriate type (or undefined)

This commit is contained in:
2023-05-30 17:41:09 -04:00
parent 45d6357937
commit 9e72e98232
5 changed files with 463 additions and 8 deletions

5
src/utils/getEnvVar.ts Normal file
View File

@@ -0,0 +1,5 @@
export const getEnvVar = (key: string) => {
const val = process.env[key];
if (!val) return undefined;
else return JSON.parse(val);
};