Skip to main content

Module env_proc

Module env_proc 

Source
Expand description

.env file processor.

Handles shell-style environment variable files with lines of the form:

KEY=value
KEY="quoted value"
KEY='single quoted'
export KEY=value
# comment lines are preserved

The export keyword is stripped before key matching so that a FieldRule for "SECRET_KEY" correctly matches both SECRET_KEY=val and export SECRET_KEY=val.

§Inline Comments

Unquoted values may have inline comments (KEY=value # comment). The comment and trailing whitespace are stripped before replacement and the comment is NOT written back (it may contain sensitive context). Quoted values are treated as opaque — everything between the quotes is the value.

§Formatting Preservation

  • Leading whitespace, blank lines, and # comment lines are preserved.
  • The original quoting style (single, double, or unquoted) is retained.
  • The export prefix, if present, is retained in the output.

Structs§

EnvProcessor
Structured processor for .env / shell environment files.