Skip to content

Updated the env parser

Rodrigo Muino Tomonari requested to merge github/fork/atomicwrite/main into main

Updated

.env parser

Notable Changes

  • heredocs
  • variable interpolation
  • control codes

All previous features including backtick quotes work the same. It passes all previous tests and I've add quite a few more. Runs quickly as I minimalized the amount of allocations by reusing a string buffer and only copying when I need to. I avoided string split and trim as well to avoid more allocs. On average in debug mode on my machine it took about 14ms to run. Mileage may vary and I know I can squeeze a little more out of it if needed.

Link to documentation

Link to new tests

Context: The current env parser doesn't have full .env compatibility. It lacks heredocs and interpolation. After a conversation with @anonrig I decided to pursue adding this to node.

Merge request reports

Loading