-
Notifications
You must be signed in to change notification settings - Fork 128
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
Fix to flags configuring ip addresses for ipv4+ipv6 compatebility #333
Fix to flags configuring ip addresses for ipv4+ipv6 compatebility #333
Conversation
c7406ac
to
ab26907
Compare
listen.apiIp = args.apiIp || "localhost"; | ||
listen.apiIp = args.apiIp; | ||
listen.apiPort = args.apiPort || listen.port + 1; | ||
listen.metricsIp = args.metricsIp || "0.0.0.0"; | ||
listen.metricsIp = args.metricsIp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these were defaults that were set above during CLI parsing anyhow. By changing this, the actual change in logic outcomes are when we pass a blank string and args.apiIp || "localhost"
no longer overrides the falsy blank string.
.option("--metrics-ip <ip>", "IP for metrics server", "0.0.0.0") | ||
.option("--metrics-ip <ip>", "IP for metrics server", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verified that CHP became accessible when configured with a blank string just as if it would have been configured with 0.0.0.0
via Z2JH's test suite, but I think using a blank string, we also acquire the sensible IPv4 and/or IPv6 compatibility we want.
Script to validate CLI parsing logic relevant to this PR#!/usr/bin/env node
var cli = require("commander");
var log = require("../lib/log.js").defaultLogger();
var args = cli
.option("--ip <ip-address>", "description...")
.option("--api-ip <ip-address>", "description...", "localhost")
.option("--metrics-ip <ip-address>", "description...", "")
.parse(process.argv)
.opts();
if (args.ip == "") {
log.error("--ip was a blank string");
} else {
log.error("--ip was: " + args.ip);
}
if (args.apiIp == "") {
log.error("--api-ip was a blank string");
} else {
log.error("--api-ip was: " + args.apiIp);
}
if (args.metricsIp == "") {
log.error("--metrics-ip was a blank string");
} else {
log.error("--metrics-ip was: " + args.metricsIp);
} |
Small changes to help z2jh avoid IPv4 and/or IPv6 issues by not specifying either
::
or0.0.0.0
but instead a blank string when we want to listen far and wide as we do in a z2jh container.Review notes
I'd love to have this merged soon and cut a release of CHP to bump if for z2jh 1.1.0 that I'd like to make next week.
Related