Skip to content

Commit

Permalink
Added bind-address cli option (#1573)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanikesn authored and bryk committed Jan 18, 2017
1 parent 0bbd01b commit 6bc2c21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/backend/dashboard.go
Expand Up @@ -25,10 +25,12 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/handler"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/pflag"
"net"
)

var (
argPort = pflag.Int("port", 9090, "The port to listen to for incoming HTTP requests")
argBindAddress = pflag.IP("bind-address", net.IPv4(0, 0, 0, 0), "The IP address on which to serve the --port (set to 0.0.0.0 for all interfaces).")
argApiserverHost = pflag.String("apiserver-host", "", "The address of the Kubernetes Apiserver "+
"to connect to in the format of protocol://address:port, e.g., "+
"http://localhost:8080. If not specified, the assumption is that the binary runs inside a "+
Expand Down Expand Up @@ -84,7 +86,7 @@ func main() {
// TODO(maciaszczykm): Move to /appConfig.json as it was discussed in #640.
http.Handle("/api/appConfig.json", handler.AppHandler(handler.ConfigHandler))
http.Handle("/metrics", prometheus.Handler())
log.Print(http.ListenAndServe(fmt.Sprintf(":%d", *argPort), nil))
log.Print(http.ListenAndServe(fmt.Sprintf("%s:%d", *argBindAddress, *argPort), nil))
}

/**
Expand Down

0 comments on commit 6bc2c21

Please sign in to comment.