We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey all! We have noticed that passing any defined values in the debug option in config function will turn on debug mode.
debug
config
e.g. all those will activate debug logs:
dotenv.config({ debug: true }) dotenv.config({ debug: false }) dotenv.config({ debug: 'foo' }) dotenv.config({ debug: 0 }) dotenv.config({ debug: {} })
The documentation mentions that debug defaults as false, but I didn't expect that passing false explicitly wouldn't make it work the same way.
What I'm exactly trying to accomplish is programmatically activate debug mode for a certain environment variable:
dotenv.config({ debug: process.env.NODE_ENV === 'development' })
The only way I've made it work was by passing an undefined or null value:
dotenv.config({ debug: process.env.NODE_ENV === 'development' ? true : undefined })
I do think this happens because options.debug is checked against null, but not against falsy values. Is this expected behavior?
options.debug
null
dotenv/lib/main.js
Lines 83 to 97 in 27dfd3f
I'm using Dotenv version 8.6.0
8.6.0
The text was updated successfully, but these errors were encountered:
This issue is still present in 10.0.0.
10.0.0
@motdotla - Can I help somehow to get #550 merged and a new release tagged?
Sorry, something went wrong.
debug: true
No branches or pull requests
Hey all! We have noticed that passing any defined values in the
debug
option inconfig
function will turn on debug mode.e.g. all those will activate debug logs:
The documentation mentions that
debug
defaults as false, but I didn't expect that passing false explicitly wouldn't make it work the same way.What I'm exactly trying to accomplish is programmatically activate debug mode for a certain environment variable:
The only way I've made it work was by passing an undefined or null value:
I do think this happens because
options.debug
is checked againstnull
, but not against falsy values. Is this expected behavior?dotenv/lib/main.js
Lines 83 to 97 in 27dfd3f
I'm using Dotenv version
8.6.0
The text was updated successfully, but these errors were encountered: