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
Given a config with the following definition:
myTestConfig: { format: Boolean, env: 'myTestConfig', default: false }
An environment variable set to myTestConfig='' is evaluated as true. Consistently reproduced with 5.1.0
myTestConfig=''
I was able to work around this by adding the following custom format:
convict.addFormat({ name: 'BooleanCustom', validate: function (val) { return (typeof val === "boolean") || (typeof val === "string") }, coerce: function (val) { return Boolean(val) } })
^The above seems unnecessary for what I expected to be default behavior.
Are empty strings expected to evaluate to Boolean true with node-convict?
The text was updated successfully, but these errors were encountered:
Reproduced on 6.0.0 as well. Empty string returns true whereas in javascript empty string is treated as false.
https://runkit.com/5f846dc85d54e8001aa64b70/5f846dc95a8dee001ab902be
Sorry, something went wrong.
Bump
Reproduced on 6.2.4 (latest as of today).
Is this a featrue?
No branches or pull requests
Given a config with the following definition:
An environment variable set to
myTestConfig=''
is evaluated as true. Consistently reproduced with 5.1.0I was able to work around this by adding the following custom format:
^The above seems unnecessary for what I expected to be default behavior.
Are empty strings expected to evaluate to Boolean true with node-convict?
The text was updated successfully, but these errors were encountered: