Skip to main content
Deno.Env.get - Deno documentation
method Deno.Env.get
allow-env
Env.get(key: string): string | undefined

Retrieve the value of an environment variable.

Returns undefined if the supplied environment variable is not defined.

console.log(Deno.env.get("HOME"));  // e.g. outputs "/home/alice"
console.log(Deno.env.get("MADE_UP_VAR"));  // outputs "undefined"

Requires allow-env permission.

Parameters

key: string

Return Type

string | undefined