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 considered nil
  • :boolean - "false", "0", or an empty string "" will be considered boolean false. Any other non-empty value is considered true.
  • :boolean? - as above, except an empty string will be considered nil
  • :integer - converts a string to an integer. An empty string will be considered 0.
  • :integer? - as above, but an empty string will be considered nil.
  • :float - converts a string to an float. An empty string will be considered 0.
  • :float? - as above, but an empty string will be considered nil.
  • :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 considered nil.

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