Skip to content

fix: ensure nf-dotenv handles duplicate env variables#18

Merged
clintval merged 1 commit intomainfrom
cv_duplicates
Sep 2, 2025
Merged

fix: ensure nf-dotenv handles duplicate env variables#18
clintval merged 1 commit intomainfrom
cv_duplicates

Conversation

@clintval
Copy link
Copy Markdown
Member

@clintval clintval commented Aug 30, 2025

This turned out to be an issue in the underlying dotenv parser and was fixed in 3.2.0:

Closes #17

@clintval clintval assigned clintval and unassigned TedBrookings Aug 31, 2025
Copy link
Copy Markdown

@TedBrookings TedBrookings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay, but I'd suggest maybe don't allow multiple definitions of the same environment. It feels like there's no good reason to have that and it's a likely bug. In my case, it was accidental and a bug. So I'd prefer the failure just with the improved error message.

@clintval
Copy link
Copy Markdown
Member Author

clintval commented Sep 2, 2025

I think this is okay, but I'd suggest maybe don't allow multiple definitions of the same environment. It feels like there's no good reason to have that and it's a likely bug. In my case, it was accidental and a bug. So I'd prefer the failure just with the improved error message.

Thanks! I realized I sent this in Slack but posting here so others can see the response:

I think because all the dotenv implementations I can find, and bash too, allow for overriding variables names, I'll keep the functionality as-is.

Situations like this are common when you source a generic dotenv file, then override with a user-specific dotenv file, or override with a variable of the same name using the local process environment.

@clintval clintval merged commit cc1662a into main Sep 2, 2025
4 checks passed
@clintval clintval deleted the cv_duplicates branch September 2, 2025 14:41
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.

Confusing error message when you add duplicate entries

3 participants