Repository navigation
πΏ dotenv-fp β Initial Release
A feature-rich dotenv library for Free Pascal 3.2.2+
We're excited to announce the first stable release of dotenv-fp, a powerful and easy-to-use library for loading environment variables from .env files in Free Pascal applications!
π Highlights
- Zero Dependencies β Uses only standard FPC units
- Zero Memory Leaks β Advanced records mean no manual
Freecalls - Type-Safe β Built-in type conversion with
GetInt(),GetBool(),GetFloat(),GetArray() - Production Ready β 96 comprehensive tests, all passing
- Cross-Platform β Works on Windows, Linux, and macOS
β¨ Features
Core Functionality
- π Load environment variables from
.envfiles - π Variable interpolation with
${VAR}or$VARsyntax - π Multi-line value support
- π― Quoted values (single quotes, double quotes, or unquoted)
- π¬ Comment support with
#(line or inline) - π Shell-compatible
exportprefix
Advanced Features
- π Type-safe getters with automatic conversion
- β‘ Default value fallbacks for missing keys
- β Built-in validation for required variables
- π Multiple file loading (
.env,.env.local,.env.production, etc.) - π·οΈ Key prefixing support (e.g., add
APP_prefix to all keys)
π¦ Installation
// 1. Copy src/DotEnv.pas to your project
// 2. Add to your uses clause
uses
DotEnv;
// 3. Load your .env file
var
Env: TDotEnv;
begin
Env := TDotEnv.Create('.env');
WriteLn(Env.Get('DATABASE_URL'));
end;π Documentation
π§ Requirements
- Free Pascal 3.2.2 or higher
- Compatible with Lazarus 4.0+
- Supports Windows, Linux, and macOS
π Acknowledgments
Inspired by python-dotenv, bringing the convenience of dotenv to the Pascal ecosystem!
π License
MIT License - see LICENSE for details
Full Changelog: https://github.com/ikelaiah/dotenv-fp/blob/main/CHANGELOG.md