forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
130 lines (120 loc) · 3.16 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package cli
import (
"os"
"path/filepath"
"runtime"
"strings"
"github.com/codegangsta/cli"
"github.com/docker/swarm/scheduler/filter"
"github.com/docker/swarm/scheduler/strategy"
)
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 (
flJoinAdvertise = cli.StringFlag{
Name: "advertise, addr",
Usage: "Address of the Docker Engine joining the cluster. Swarm manager(s) MUST be able to reach the Docker Engine at this address.",
EnvVar: "SWARM_ADVERTISE",
}
flManageAdvertise = cli.StringFlag{
Name: "advertise, addr",
Usage: "Address of the swarm manager joining the cluster. Other swarm manager(s) MUST be able to reach the swarm manager at this address.",
EnvVar: "SWARM_ADVERTISE",
}
// hack for go vet
flHostsValue = cli.StringSlice([]string{"tcp://127.0.0.1:2375"})
flHosts = cli.StringSliceFlag{
Name: "host, H",
Value: &flHostsValue,
Usage: "ip/socket to listen on",
EnvVar: "SWARM_HOST",
}
flHeartBeat = cli.StringFlag{
Name: "heartbeat",
Value: "20s",
Usage: "period between each heartbeat",
}
flTTL = cli.StringFlag{
Name: "ttl",
Value: "60s",
Usage: "sets the expiration of an ephemeral node",
}
flTimeout = cli.StringFlag{
Name: "timeout",
Value: "10s",
Usage: "timeout period",
}
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",
}
flStrategy = cli.StringFlag{
Name: "strategy",
Usage: "placement strategy to use [" + strings.Join(strategy.List(), ", ") + "]",
Value: strategy.List()[0],
}
// hack for go vet
flFilterValue = cli.StringSlice(filter.List())
// DefaultFilterNumber is exported
DefaultFilterNumber = len(flFilterValue)
flFilter = cli.StringSliceFlag{
Name: "filter, f",
Usage: "filter to use [" + strings.Join(filter.List(), ", ") + "]",
Value: &flFilterValue,
}
flCluster = cli.StringFlag{
Name: "cluster-driver, c",
Usage: "cluster driver to use [swarm, mesos-experimental]",
Value: "swarm",
}
flClusterOpt = cli.StringSliceFlag{
Name: "cluster-opt",
Usage: "cluster driver options",
Value: &cli.StringSlice{},
}
flDiscoveryOpt = cli.StringSliceFlag{
Name: "discovery-opt",
Usage: "discovery options",
Value: &cli.StringSlice{},
}
flLeaderElection = cli.BoolFlag{
Name: "replication",
Usage: "Enable Swarm manager replication",
}
flLeaderTTL = cli.StringFlag{
Name: "replication-ttl",
Value: "30s",
Usage: "Leader lock release time on failure",
}
)