The setting types Macaw.Host.Config understands, and how a value of each
is read from an environment variable (a string) or checked from
config.exs (a literal).
| Type | From the file | From an env var |
|---|---|---|
:string, :secret | a string | as is |
:optional_string | a string or nil | as is; empty is nil |
:boolean | true or false | true, false, 1, 0 |
:integer, :pos_integer, :port | an integer in range | decimal digits |
{:enum, [atom]} | one of the atoms | its name |
:string_list | a list of strings | comma-separated |
{:custom, {m, f}} | m.f(value) returns {:ok, v} or {:error, message} | the same, given the string |
A :secret is masked wherever a value is shown (Macaw.Host.Config.show/1, Macaw.Host.Config.mask/2).
Enum names from env vars are compared as strings, so no atom is made.
Summary
Functions
Reads a value from an env var's string: {:ok, value} or {:error, why}.
Checks a value from config.exs: {:ok, value} or {:error, why}.
A type in words, for fault messages.
Types
Functions
Reads a value from an env var's string: {:ok, value} or {:error, why}.
Checks a value from config.exs: {:ok, value} or {:error, why}.
A type in words, for fault messages.