New issue
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
MAILDEV_OUTGOING_SECURE is not honored #315
Comments
Also, I investigated a bit further, and it seems that all the "booleans" input args are not being processed well when using env vars. |
I'm not sure what the desired behavior is, but this change to FOO=false
FOO=true
FOO=bar
# Uses the default value
FOO= diff --git a/lib/options.js b/lib/options.js
index 3e67bc9..f487eed 100644
--- a/lib/options.js
+++ b/lib/options.js
@@ -39,7 +39,11 @@ module.exports.appendOptions = function (program, options) {
const flag = option[0]
const envVariable = option[1]
const description = option[2]
- const defaultValue = process.env[envVariable] || option[3]
+ const envValue = process.env[envVariable] || ""
+ // If the env value is "true" or "false", parse it as a boolean
+ // Else, if it is a non-falsy value, use it
+ // Else, use the default value
+ const defaultValue = envValue.toLowerCase() == "false" ? false : envValue.toLowerCase() == "true" || envValue || option[3]
const fn = option[4]
if (fn) {
return chain.option(flag, description, fn, defaultValue) I can submit this as a PR, but I don't know if you want a more capable options parser that would also allow 0 and 1 which are often accepted in environment variables. |
Commander may need to be updated to 3.0.0+ too, I didn't test this. |
I can confirm that this change from @bburky fixes the issue with boolean environment variables. Can we have this code merged? |
Don't know wich one of the solution is better than the other, but it should be great to have one quickly :) |
Hey!!
Awesome project!!
I just notice that no matter whether MAILDEV_OUTGOING_SECURE is set or not, it is not honored, defaults to unsecure always.
Code "compiled" from master.
Thanks!
The text was updated successfully, but these errors were encountered: