Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Issue 75
Changes
--bind
flag field inoptions
inmain
package.StartServer
(and few other internal functions) made method(s) to a newly introduced typeServer
.Summary
--bind
for binding-host-address to be read from CLI flag also (earlier: env and default only). The precedence order now is:flag
--bind=<host>
> envHD_BIND=<host>
> default valuelocalhost
StartServer
and other internal functions are made methods to typeServer
in order to limit the number of arguments passed. This way, the code is cleaner.Related Issues
Closes #75
Message for Maintainers
Given the current setup of function calls in most packages (observed specifically on
main
,pkg/dashboard
andpkg/dashboard/subproc
packages with this change), the mocking for unit tests is hardly possible. Hence, the current change was tested manually. Also, the code coverage is low.Please confirm if issues and PRs will be accepted to revamp code to certain level. Roughly put, this would require the following things: