Skip to content

🌿 dotenv-fp – Initial Release

Choose a tag to compare

@ikelaiah ikelaiah released this 11 Dec 19:28
· 12 commits to main since this 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 Free calls
  • 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 .env files
  • πŸ”— Variable interpolation with ${VAR} or $VAR syntax
  • πŸ“ Multi-line value support
  • 🎯 Quoted values (single quotes, double quotes, or unquoted)
  • πŸ’¬ Comment support with # (line or inline)
  • 🐚 Shell-compatible export prefix

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