Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/env/env.js>Env

A utility for verifying environment variables are present
Go to Latest
class Env
import { Env } from "https://deno.land/x/env@v3.0.3/env.js";

A utility for interacting with environment variables

Constructors

new
Env(source?)

Creates a new instance of Env.

Properties

readonly
exists

Lazy-loading property containing a proxy that can be used to automatically throw errors when an undefined environment variable is accessed.

readonly
required

Lazy-loading property containing a proxy that can be used to automatically throw errors when an undefined or empty string environment variable is accessed.

Methods

first(keys, defaultValue)
get(key, defaultValue)
has(key)

Determines if a given environment variable exists.

require(key)

Retrieves an environment variable. If the environment variable does not exist or is an empty string, then it throws an error.

Retrieves the first environment variable found in a list of environment variable names and throws an error if none of the variables are found.