This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
106 lines (97 loc) · 2.29 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
package main
import (
"os"
"path/filepath"
"runtime"
"github.com/codegangsta/cli"
)
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]
}
dis := os.Getenv("SWARM_DISCOVERY")
if dis == "" {
dis = "ansible://all"
}
return dis
}
var (
flStore = cli.StringFlag{
Name: "rootdir",
Value: homepath(".swarm"),
Usage: "",
}
flAddr = cli.StringFlag{
Name: "addr",
Value: "127.0.0.1:2375",
Usage: "ip to advertise",
EnvVar: "SWARM_ADDR",
}
// 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.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 [spread, binpack, random]",
Value: "spread",
}
// hack for go vet
flFilterValue = cli.StringSlice([]string{"constraint", "affinity", "health", "port", "dependency"})
DEFAULT_FILTER_NUMBER = len(flFilterValue)
flFilter = cli.StringSliceFlag{
Name: "filter, f",
Usage: "filter to use [constraint, affinity, health, port, dependency]",
Value: &flFilterValue,
}
flCluster = cli.StringFlag{
Name: "cluster, c",
Usage: "cluster to use [swarm, mesos]",
Value: "swarm",
}
)