blob: e80ec4ac4576b5dbadca3edc3008cb28ecb9d613 (
plain)
1
2
3
4
5
6
7
8
9
10
|
import { Either, type IEither } from "@emprespresso/utils";
export const getRequiredEnv = (name: string): IEither<Error, string> =>
Either.fromFailable(() => {
const value = Deno.env.get(name); // could throw when no permission.
if (!value) {
throw new Error(`environment variable "${name}" is required D:`);
}
return value;
});
|