Option allowEmptyValues set to true is not working
node version: v10.20.1
dotenv-safe version: 8.2.0
I set the allowEmptyValues to true but I'm still getting the MissingEnvVarsError.
Here is my code:
require('dotenv-safe').config({
allowEmptyValues: true,
path: path.join(__dirname, '../../.env'),
example: path.join(__dirname, '../../.env.example'),
});
I couldn't figure out what I'm missing here. Thank you for your help!
same issue here, the allowEmptyValues set to true does nothing.
@Yosr-Ch @antonedvard
If you have an .env.example file and .env file as mentioned below it will even throw an error with the allowEmptyValues as true if that is your case this will help.
# .env.example, committed to repo
SECRET=
TOKEN=
KEY=
# .env, private
SECRET=topsecret
TOKEN=
The allowEmptyValues just allows to have an empty value in the .env file but does not allow to skip a key in the .env file.
So the .env file should look like this to work with allowEmptyValues: true
# .env, private
SECRET=topsecret
TOKEN=
KEY=