fiction_env
A provider for fiction that processes environment variables.
gleam add fiction_env@1
import fiction/providers/env
import fiction
pub fn main() -> Nil {
let assert Ok(_) =
fiction.new()
// collect all environment variables with a prefix,
// using the unprefixed and lowercased name as the key for the value (eg. APP_FOO -> foo)
|> fiction.join(env.prefixed("APP_"))
// try to get values from a list of names
// if a value is available the key will be the lowercased name (eg. FOO -> foo)
|> fiction.join(env.exact(["FOO", "BAR"]))
|> fiction.extract(..)
}
Further documentation can be found at https://hexdocs.pm/fiction_env.
Development
gleam test # Run the tests