mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
fix(dotenv): implement secure parsing for .env files and add comprehensive tests
This commit is contained in:
parent
139bc2b5a1
commit
2014363332
10 changed files with 850 additions and 1 deletions
23
plugins/dotenv/tests/_support/fixtures/features.env
Normal file
23
plugins/dotenv/tests/_support/fixtures/features.env
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Export syntax
|
||||
export EXPORTED_VAR=exported_value
|
||||
export EXPORTED_EMPTY=
|
||||
|
||||
# Variable expansion (in-file forward references)
|
||||
BASE_URL=https://api.example.com
|
||||
API_ENDPOINT="${BASE_URL}/v1"
|
||||
FULL_ENDPOINT=$BASE_URL/v2/users
|
||||
COMBINED="${BASE_URL}_suffix"
|
||||
|
||||
# Testing multiline quoting edge cases
|
||||
MULTILINE_UNQUOTED=This\ is\ a\ \
|
||||
multiline\ value\ that\ should\ be\ treated\ as\ a\ single\ line\ with\ a\ literal\ backslash\ and\ newline
|
||||
MULTILINE_DOUBLE_QUOTED="This is a \
|
||||
multiline value that should be treated as a single line with an actual newline character"
|
||||
MULTILINE_SINGLE_QUOTED='This is a \
|
||||
multiline value that should be treated as a single line with a literal backslash and newline'
|
||||
MULTILINE_MIXED_QUOTES="This is a \
|
||||
multiline value that should be treated as a single line with an actual newline character and a literal backslash \"and 'single quotes' inside"
|
||||
|
||||
# Test for regressions
|
||||
DATABASE_URL="postgres://user:pass@host/db;sslmode=require"
|
||||
VAR_WITH_SEMICOLONS="value ; with ; semicolons"
|
||||
Loading…
Add table
Add a link
Reference in a new issue