dotenv-java
dotenv-java copied to clipboard
Add option to treat empty strings as `null` values
Hey,
First of all, thanks a load for your work! This package is awesome! It's extremely useful and the code is super easy to navigate and work with 🙌
I would like to add an option to treat empty strings as null values. A use case can be the following .env file that indicates that values must be set, i.e., "" is not a valid value:
$ cat .env.example
# Make sure the following variables are set
MY_ENV_VAR1=
MY_EVV_VAR2=
The ignoreEmpty option shines when it comes to usage in Kotlin, e.g.:
dotenv["MY_ENV_VAR1"] ?: throw ...