Dotenvy.env
You're seeing just the function
env
, go back to Dotenvy module for more information.
Specs
Attempts to read the given system environment variable
; if it exists, its
value is converted to the given type
. If the variable is not found, the
provided default
is returned.
The default
value will not be converted: it will be returned as-is.
This allows greater control of the output.
Although this relies on System.fetch_env/1
, it may still raise an error
if an unsupported type
is provided.
Examples
iex> env("PORT", :integer, 5432)
5433
iex> env("NOT_SET", :boolean, %{not: "converted"})
%{not: "converted"}