envful icon indicating copy to clipboard operation
envful copied to clipboard

Warn on duplicate value for variable

Open arvindell opened this issue 3 years ago • 3 comments

This feature proposes adding a warning/error on the case that a user's environment defines two variables with the same name. For example:


NEXT_PUBLIC_API_URL=http://localhost:4000
SOME_OTHER_VARS=12345


NEXT_PUBLIC_API_URL=https://api.quentli.com

This could catch situations in a user runs runs a process with an unintended env.

arvindell avatar Mar 01 '22 18:03 arvindell

Although I like this feat, I vote for it to be an optional feature because sometimes we may need to have multiple variables just for rapid testing purposes as the env file will be still valid (I'm thinking of dotenv here)

Maybe under the flag --no-duplicate, idk

micalevisk avatar Mar 06 '22 23:03 micalevisk

Although I like this feat, I vote for it to be an optional feature because sometimes we may need to have multiple variables just for rapid testing purposes as the env file will be still valid (I'm thinking of dotenv here)

Maybe under the flag --no-duplicate, idk

Interesting, can you explain why you would have multiple values for a variable? Doesn't a line comment (#) cover this use case? 🤔

arvindell avatar Mar 07 '22 03:03 arvindell

Doesn't a line comment (#) cover this use case?

it does but (for me, while I'm testing various values) duplicating the line + changing it is quickler than duplicating + comment-in + changing the other one

But yeah, at same time I might not need to use envful before removing those duplicated values

My real concern here is that: before, I was using envful to check the presence of env. vars, but now (after that feat) it's also doing some validation that could be too strict (as dotenv won't complain on duplicate values)

micalevisk avatar Mar 07 '22 03:03 micalevisk