Skip to main content

Module env_parser

Module env_parser 

Source
Expand description

Pure env-file parser (no I/O, no set_var). Used by startup bootstrap and admin import endpoint. Pure .anyllm.env-format parser. No I/O, no set_var — safe from any context including tests.

Format rules (bash-compatible subset):

  • Lines starting with # are comments.
  • KEY=value or KEY="value" or KEY='value'.
  • Double-quoted values interpret \n, \t, \r, \\, \".
  • Single-quoted values are literal (no escape processing, matching bash behavior).
  • Keys must match [A-Z_][A-Z0-9_]* (POSIX portable env var names).

Structs§

EnvWarning
A non-fatal issue found during parsing (unknown key, duplicate, sensitive overwrite, etc.).
ParseResult
The result of parsing a .anyllm.env file. If hard_errors is non-empty the caller must abort — do NOT write pairs to the database.
ParsedPair
A successfully parsed key-value pair from an env file.

Functions§

escape_for_env_file
Escape a value for double-quoted .anyllm.env output. Produces a string safe to wrap in "...".
parse_env_content
Parse .anyllm.env-format content without any I/O or side effects.