System.get_env

You're seeing just the function get_env, go back to System module for more information.

Specs

get_env() :: %{optional(String.t()) => String.t()}

Returns all system environment variables.

The returned value is a map containing name-value pairs. Variable names and their values are strings.

Link to this function

get_env(varname, default \\ nil)

View Source (since 1.9.0)

Specs

get_env(String.t(), String.t() | nil) :: String.t() | nil

Returns the value of the given environment variable.

The returned value of the environment variable varname is a string. If the environment variable is not set, returns the string specified in default or nil if none is specified.

Examples

iex> System.get_env("PORT")
"4000"

iex> System.get_env("NOT_SET")
nil

iex> System.get_env("NOT_SET", "4001")
"4001"