mic-bot/utils/env.ts

10 lines
253 B
TypeScript
Raw Permalink Normal View History

2024-10-19 10:00:35 +00:00
import { BadConfigErr } from "./errors.ts";
export const mustGetEnv = (envName: string): string => {
const env = Deno.env.get(envName)
if (!env) {
throw new BadConfigErr(`required environment variable ${envName} wasn't set`)
}
return env
}