get env variables

This commit is contained in:
Robert 2024-03-07 05:16:52 +07:00
parent b16c2b395d
commit 75ae50a552
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -0,0 +1,9 @@
export function getEnvVar(variable: string): string {
const value = import.meta.env[variable];
if (typeof value === "string") {
return value;
} else {
throw new Error(`Environment variable ${variable} is required`);
}
}