penv 2.0.0
penv: ^2.0.0 copied to clipboard
A tiny, dependency-light loader for .env-style environment files.
2.0.0 #
- Parsing: support a leading
exportprefix on lines (as used by shell-sourced env files), trailing inline comments on unquoted values (PORT=8080 # default), and backslash escapes inside double-quoted values (\n,\t,\r,\",\\,\$). Single-quoted values remain literal, matching common.env/shell convention. - Variable expansion:
${OTHER_KEY}references inside unquoted or double-quoted values are now expanded against keys defined earlier in the same file, falling back to the current process environment. Controlled by the newexpandVariablesparameter (defaulttrue). - Process environment overlay: new
useProcessEnvironmentandpreferProcessEnvironmentparameters let real deployment environment variables (Docker, CI, hosting platforms) take priority over a checked-in.envfile, for keys declared in that file — unrelated system variables (PATH,HOME, etc.) are never pulled in. - Required keys: new
requiredparameter validates that a list of keys is present with non-empty values after parsing, throwing the newMissingRequiredKeysException(with the full list of missing keys) otherwise. penvloadOrNull: a non-throwing variant that returnsnullinstead of throwingEnvFileNotFoundExceptionfor an optional file, and never creates a placeholder.penvloadAsync: an async equivalent ofpenvloadfor callers that avoid synchronous file I/O.- Typed accessors: new
getInt,getDouble,getBool, andgetStringextension methods onMap<String, String>, with optionaldefaultValues and clearFormatExceptions on missing/invalid values. - Fixed a broken pub badge in the README that pointed at the wrong package name.
1.0.0 #
- Initial release.