A simple Lua module to load environment variables from a .env file.
You can install the dotenv module using LuaRocks:
luarocks install dotenvrequire "dotenv".config()
print(os.getenv("MY_VARIABLE"))
print(os.getenv("ANOTHER_VARIABLE")) MY_VARIABLE=HelloWorld
ANOTHER_VARIABLE=42
This project is licensed under the MIT License. See the LICENSE file for details.
- Loads environment variables from a
.envfile. - Supports comments and blank lines.
- Handles quoted values.
- Automatically trims whitespace around keys and values.
- Supports multi-line values.