envoker
envoker is a small Gleam helper for reading environment variables through
envoy with a typed API.
It provides:
- required and optional readers
- built-in parsing for
String,Int,Float, andBool - defaults for missing or empty values
- structured errors for missing, empty, and invalid fields
Installation
gleam add envoker
Example
import envoker
import gleam/option
pub fn load_config() {
let assert Ok(host) =
envoker.read_required_string("HOST", option.None)
let assert Ok(port) =
envoker.read_required_int("PORT", option.Some(8080))
let assert Ok(debug) =
envoker.read_optional_bool("DEBUG", option.Some(False))
#(host, port, debug)
}
String values are trimmed before validation and return, and Bool parsing is
case-insensitive for true and false.
Development
gleam test
gleam check