cmd/swarm: include localhost flag

This commit is contained in:
Anton Evangelatov 2018-04-26 16:41:08 +02:00
parent 52148f6a93
commit 4e882674e0
2 changed files with 16 additions and 6 deletions

View file

@ -27,12 +27,13 @@ import (
)
var (
endpoints []string
cluster string
scheme string
filesize int
from int
to int
endpoints []string
includeLocalhost bool
cluster string
scheme string
filesize int
from int
to int
)
func main() {
@ -68,6 +69,11 @@ func main() {
Usage: "http or https",
Destination: &scheme,
},
cli.BoolFlag{
Name: "include-localhost",
Usage: "whether to include localhost:8500 as an endpoint",
Destination: &includeLocalhost,
},
cli.IntFlag{
Name: "filesize",
Value: 1,

View file

@ -24,6 +24,10 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
for port := from; port <= to; port++ {
endpoints = append(endpoints, fmt.Sprintf("%s://%v.%s.swarm-gateways.net", scheme, port, cluster))
}
if includeLocalhost {
endpoints = append(endpoints, "http://localhost:8500")
}
}
func cliUploadAndSync(c *cli.Context) error {