Last year at Jax.Ex (Jacksonville Elixir Meetup) we live mob coded the start of a dotenv parser to learn NimbleParsec. It’s been on my list of things to complete for a while. Today Claude Code helped me finish the outstanding issues.
Features
- Comments: Lines starting with
#are ignored- Export prefix: Optional
exportkeyword (shell compatibility)- Quoted values: Single and double quotes with escape sequences
- Multi-line values: Quoted values can span multiple lines
- Empty values:
KEY=produces an empty string- Digits in keys: Variable names like
DB2_HOST,API_V2_URLare supported- Escape sequences:
\n,\t,\r,\\,\",\'in quoted strings- Blank lines: Multiple blank lines and trailing whitespace are handled correctly
You can use it like this:
# config/runtime.exs
import Config
# Load environment-specific .env file if it exists
env_file = ".#{config_env()}.env"
if File.exists?(env_file) do
env_file |> File.read!() |> Envious.parse!() |> System.put_env()
end
# Do your normal 12-factor things
config :my_app,
key1: System.get_env("KEY1"),
key2: System.get_env("KEY2")
Hope you find it useful. ![]()






















