Build::EnvFormat
Parse and emit shell-style KEY=VALUE environment assignments.
Accepts the subset of POSIX sh assignment syntax used by
bld config -s, heroku config -s, export -p, and common
.env files:
[export] IDENT=<value> value := '...' literal | "..." with \n \t \r \ " $ ` escapes | $'...' ANSI-C: \n \t \r \ ' " \0 \a \b \e \f \v | bare unquoted, no expansion
Values may concatenate quoted and unquoted segments like real shell:
'it'\''s' parses as it's, matching what our emitter produces for
a value containing a single quote. Quoted segments can span newlines.
SECURITY: this is deliberately NOT a shell. It never performs variable expansion, command substitution, arithmetic, globbing, or any other form of evaluation. The worst an attacker can do with crafted input is set config var values to arbitrary bytes — which any user can already do via explicit KEY=VALUE args. That invariant keeps the attack surface of piping a file identical to passing args explicitly.
Class methods
Parse assignments out of a raw string. Lines that don't match the grammar (malformed, stray text, etc.) are silently skipped to stay tolerant of format drift between producers.