forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
87 lines (83 loc) · 1.92 KB
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
import (
"github.com/codegangsta/cli"
"os"
"path/filepath"
"runtime"
)
func homepath(p string) string {
home := os.Getenv("HOME")
if runtime.GOOS == "windows" {
home = os.Getenv("USERPROFILE")
}
return filepath.Join(home, p)
}
func getDiscovery(c *cli.Context) string {
if len(c.Args()) == 1 {
return c.Args()[0]
}
return os.Getenv("SWARM_DISCOVERY")
}
var (
flStore = cli.StringFlag{
Name: "rootdir",
Value: homepath(".swarm"),
Usage: "",
}
flAddr = cli.StringFlag{
Name: "addr",
Value: "127.0.0.1:4243",
Usage: "ip to advertise",
EnvVar: "SWARM_ADDR",
}
flHosts = cli.StringSliceFlag{
Name: "host, H",
Value: &cli.StringSlice{"tcp://127.0.0.1:2375"},
Usage: "ip/socket to listen on",
EnvVar: "SWARM_HOST",
}
flHeartBeat = cli.IntFlag{
Name: "heartbeat, hb",
Value: 25,
Usage: "time in second between each heartbeat",
}
flEnableCors = cli.BoolFlag{
Name: "api-enable-cors, cors",
Usage: "enable CORS headers in the remote API",
}
flTls = cli.BoolFlag{
Name: "tls",
Usage: "use TLS; implied by --tlsverify=true",
}
flTlsCaCert = cli.StringFlag{
Name: "tlscacert",
Usage: "trust only remotes providing a certificate signed by the CA given here",
}
flTlsCert = cli.StringFlag{
Name: "tlscert",
Usage: "path to TLS certificate file",
}
flTlsKey = cli.StringFlag{
Name: "tlskey",
Usage: "path to TLS key file",
}
flTlsVerify = cli.BoolFlag{
Name: "tlsverify",
Usage: "use TLS and verify the remote",
}
flOverCommit = cli.Float64Flag{
Name: "overcommit, oc",
Usage: "overcommit to apply on resources",
Value: 0.05,
}
flStrategy = cli.StringFlag{
Name: "strategy",
Usage: "placement strategy to use [binpacking, random]",
Value: "binpacking",
}
flFilter = cli.StringSliceFlag{
Name: "filter, f",
Usage: "filter to use [constraint, affinity, health, port]",
Value: &cli.StringSlice{"constraint", "affinity", "health", "port"},
}
)