penv 2.0.0 copy "penv: ^2.0.0" to clipboard
penv: ^2.0.0 copied to clipboard

A tiny, dependency-light loader for .env-style environment files.

2.0.0 #

  • Parsing: support a leading export prefix 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 new expandVariables parameter (default true).
  • Process environment overlay: new useProcessEnvironment and preferProcessEnvironment parameters let real deployment environment variables (Docker, CI, hosting platforms) take priority over a checked-in .env file, for keys declared in that file — unrelated system variables (PATH, HOME, etc.) are never pulled in.
  • Required keys: new required parameter validates that a list of keys is present with non-empty values after parsing, throwing the new MissingRequiredKeysException (with the full list of missing keys) otherwise.
  • penvloadOrNull: a non-throwing variant that returns null instead of throwing EnvFileNotFoundException for an optional file, and never creates a placeholder.
  • penvloadAsync: an async equivalent of penvload for callers that avoid synchronous file I/O.
  • Typed accessors: new getInt, getDouble, getBool, and getString extension methods on Map<String, String>, with optional defaultValues and clear FormatExceptions on missing/invalid values.
  • Fixed a broken pub badge in the README that pointed at the wrong package name.

1.0.0 #

  • Initial release.
0
likes
160
points
150
downloads

Documentation

API reference

Publisher

verified publisherpsdkjoon.ir

Weekly Downloads

A tiny, dependency-light loader for .env-style environment files.

Repository (GitHub)
View/report issues

Topics

#environment

License

MIT (license)

More

Packages that depend on penv