LukasKalbertodt / confique

Type-safe, layered, light-weight, `serde`-based configuration library
https://docs.rs/confique
Apache License 2.0
167 stars 12 forks source link

empty strings for env bools #35

Open jdx opened 8 months ago

jdx commented 8 months ago

I think empty strings should be the same as not defined, e.g.:

$ COLOR= mycli

Users commonly use an empty string in env vars like this since it's easier than removing them. I think potentially this could be configurable (somehow) like viper does.

LukasKalbertodt commented 6 months ago

I'm a bit uncomfortable pushing this. Conflating "doesn't exist" with "empty string" doesn't sit right with me. It's not impossible to imagine a scenario where setting a value to an empty string is desired. And at least I personally am not familiar with the "set to empty string as that's easier than unsetting" idiom (which doesn't mean much, just FYI).

So yes, if this feature is added at all, it needs to be configurable. With the current behavior as the default I assume...

jdx commented 1 week ago

as an example, if I want to set MISE_DEBUG and MISE_TRACE to the default I'd like to do the following:

MISE_DEBUG= MISE_TRACE= mise ...

but with the way confique deals with booleans currently I can't do this, I have to pick true or false