Skip to content

Conversation

@bbc2
Copy link
Collaborator

@bbc2 bbc2 commented Nov 15, 2020

Closes #282

bbc2 added 3 commits November 15, 2020 15:28
This is now done in two steps:

- Parse the value into a sequence of atoms (literal of variable).
- Resolve that sequence into a string.
This fixes an issue when a variable is resolved differently in two
bindings.

For instance, take the following env file:

```
PORT=8000
URL=http://localhost:${PORT}
```

With `PORT` set to `1234` in the environment, the environment resulting
from `dotenv_load(override=False)` would be:

```
PORT=1234
URL=http://localhost:8000
```

This was inconsistent and is fixed by this commit.  The environment
would now be:

```
PORT=1234
URL=http://localhost:1234
```

with override, and

```
PORT=8000
URL=http://localhost:8000
```

without override.

The behavior of `load_dotenv` is unchanged and always assumes
`override=True`.
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.0%) to 88.309% when pulling 5a797e0 on bbc2:fix-variable-expansion-order into e13d957 on theskumar:master.

@bbc2 bbc2 merged commit 26ff5b7 into theskumar:master Dec 5, 2020
@bbc2 bbc2 deleted the fix-variable-expansion-order branch December 5, 2020 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistency in priorities of variable expansion

2 participants