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 #981 Use -webserverip to set http listen address #1032
Conversation
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.
Thank you! Just one comment about the default.
default listen address changed. Added admin REST API endpoint, with type validation. Only tested with curl, not against the actual admin UI. This should validate the IP, so people can't brick the config. Not sure about the UI interaction in case of an error, so left out for now. |
controllers/admin/config.go
Outdated
_, is_float := configValue.Value.(float64) | ||
if !is_float { | ||
return | ||
} |
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.
Thanks for adding this check! Instead of asserting the type once here to check it, and then another time to actually use it, could this be swaped around a bit (excuse the bad code inside a comment box):
if port, ok := configValue.Value.(float64); ok {
...setHttpPort(port)
} else {
BadRequestHandler(w, "bad request or some message")
}
And the same can probably be done with the SetWebServerIP
check/use as well.
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.
Gotcha, will do.
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.
71aca7e should have a better logic and also checks port range and validates given IP
Thanks for working on this! I'm not sure yet if we want this configurable in the admin or not (I'm kind of leaning to it being a cli flag only), so I'll probably pull out the APIs if that's the case, but I'll leave it for now so we have the option. Thanks again! |
Followed the HTTP port code with an extra IP address validation in the router.
It works via command line flag, but not sure what is needed for configuration from the admin web UI.
Literally my first Go code :)