cli icon indicating copy to clipboard operation
cli copied to clipboard

The port number of the dashboard supports automatic selection.

Open imneov opened this issue 3 years ago • 4 comments

Describe the proposal

The port of the dashboard should support automatic selection. When the --port flag is set to 0, a free port will be randomly found to start the dashboard to ensure that there will be no port conflicts.

Release Note

RELEASE NOTE:

  • [x] the --port flag could be set to 0, In this case, dashboard will server on a random port which is free.

imneov avatar Dec 26 '21 15:12 imneov

We can update portforward.LocalPort use fw.GetPorts() when portforward is Ready.


failure := make(chan error)
go func() {
	if err := fw.ForwardPorts(); err != nil {
		failure <- err
	}
}()

select {
// if `fw.ForwardPorts()` succeeds, block until terminated
case <-pf.ReadyCh:
	ports, err := fw.GetPorts()
	if err == nil && len(ports) > 0{
		pf.LocalPort = int(ports[0].Local)
		pf.RemotePort = int(ports[0].Remote)
	}
// if failure, causing a receive `<-failure` and returns the error
case err := <-failure:
	return err
}

imneov avatar Dec 27 '21 07:12 imneov

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Feb 14 '22 01:02 dapr-bot

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

dapr-bot avatar Feb 21 '22 01:02 dapr-bot

@mukundansundar can you please open this issue again? There is an associated PR to close it.

shubham1172 avatar Apr 18 '22 07:04 shubham1172