EnvLoader (EnvLoader v0.1.0)
View SourceA lightweight, dependency-free Elixir library for loading .env
files into the system environment.
Built for simplicity and robustness, it handles edge cases like comments, quoted values, EXPORT
directives, empty keys, and inline comments with fewer than 60 lines of code.
Summary
Functions
Loads environment variables from a .env file at the given path.
Functions
Loads environment variables from a .env file at the given path.
Parameters
path
: Path to the .env file (e.g., "./envs/.env").
Returns
:ok
on success,:error
if the file is not found.
Examples
iex> File.write!("test.env", "KEY=value")
iex> EnvLoader.load("test.env")
:ok
iex> System.get_env("KEY")
"value"
iex> File.rm!("test.env")