Dotenvy.Transformer.env-exclamation-mark
You're seeing just the function
env-exclamation-mark
, go back to Dotenvy.Transformer module for more information.
See System.fetch_env!/1
.
Looks up the given varname
from the System
and converts it to the given type
with conveniences for supporting nullable values.
Remember: conversion is necessary because system ENV values are always strings.
Types
The following types are supported:
:atom
- converts to an atom. An empty string will be the atom:""
(!).:atom?
- converts to an atom. An empty string will be considerednil
:boolean
- "false", "0", or an empty string "" will be considered booleanfalse
. Any other non-empty value is consideredtrue
.:boolean?
- as above, except an empty string will be considerednil
:integer
- converts a string to an integer. An empty string will be considered0
.:integer?
- as above, but an empty string will be considerednil
.:float
- converts a string to an float. An empty string will be considered0
.:float?
- as above, but an empty string will be considerednil
.:existing_atom
- converts into an existing atom. Raises on error.:module
- converts a string into an Elixir module name. Raises on error.:module?
- as above, but an empty string will be considerednil
.
Examples
iex> env!("DB_PORT", :integer)
5432
iex> env!("DB_PORT", :boolean)
false
iex> env!("HTTP_CLIENT_MODULE", :module)
HTTPoison
iex> env!("LOG_LEVEL", :atom)
:debug