本文整理汇总了Golang中github.com/docker/docker/pkg/mflag.BoolVar函数的典型用法代码示例。如果您正苦于以下问题:Golang BoolVar函数的具体用法?Golang BoolVar怎么用?Golang BoolVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BoolVar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: readConfig
func readConfig() {
var (
configFile string
showHelp, showVersion bool
)
logFilter = &logutils.LevelFilter{
Levels: logLevels,
MinLevel: logMinLevel,
Writer: os.Stderr,
}
log.SetOutput(logFilter)
flag.StringVar(&configFile, []string{"c", "-config"}, "/etc/logear/logear.conf", "config file")
flag.StringVar(&logFile, []string{"l", "-log"}, "", "log file")
flag.BoolVar(&showHelp, []string{"h", "-help"}, false, "display the help")
flag.BoolVar(&showVersion, []string{"v", "-version"}, false, "display version info")
flag.Parse()
if showHelp {
flag.Usage()
os.Exit(0)
}
if showVersion {
println(versionstring)
println("OS: " + runtime.GOOS)
println("Architecture: " + runtime.GOARCH)
os.Exit(0)
}
parseTomlFile(configFile)
startLogging()
log.Printf("%s started with pid %d", versionstring, os.Getpid())
}
开发者ID:DLag,项目名称:logear,代码行数:30,代码来源:config.go
示例2: init
func init() {
flag.Bool([]string{"h", "-help"}, false, "Display help")
flag.BoolVar(&verbose, []string{"v", "-verbose"}, false, "Switch to verbose output")
flag.BoolVar(&print_digest, []string{"d", "-digest"}, false, "Print also digest of manifest")
flag.StringVar(&key, []string{"k", "-key-file"}, "", "Private key with which to sign")
flag.Parse()
}
开发者ID:TomasTomecek,项目名称:docker-manifest,代码行数:7,代码来源:main.go
示例3: init
func init() {
// Arguments for ssh server
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false,
"display this help message")
flag.BoolVar(&server, []string{"s", "-server"}, false,
"start the server")
flag.StringVar(&listen, []string{"l", "-listen"}, "0.0.0.0",
"start the server")
flag.IntVar(&port, []string{"p", "-port"}, 5566,
"port to listen")
flag.StringVar(&user, []string{"-user"}, "sshcam",
"username for SSH login")
flag.StringVar(&pass, []string{"-pass"}, "[email protected]",
"password for SSH login")
// Arguments for img2xterm
flag.BoolVar(&colorful, []string{"c", "-color"}, false,
"turn on color")
flag.BoolVar(&asciiOnly, []string{"-ascii-only"}, false,
"fallback to use ASCII's full block characters")
flag.StringVar(&distanceAlgorithm, []string{"-color-algorithm"}, "yiq",
"algorithm use to compute colors. Available options are:\n"+
"'rgb': simple linear distance in RGB colorspace\n"+
"'yiq': simple linear distance in YIQ colorspace (the default)\n"+
"'cie94': use the CIE94 formula")
flag.IntVar(&maxFPS, []string{"-max-fps"}, 4,
"limit the maximum FPS")
flag.StringVar(&device, []string{"-device"}, "/dev/video0",
"the webcam device to open")
flag.StringVar(&sizeFlag, []string{"-size"}, "640x480",
"image dimension, must be supported by the device")
flag.Parse()
size = wxh2Size(sizeFlag)
}
开发者ID:cs12b033,项目名称:sshcam,代码行数:35,代码来源:sshcam.go
示例4: main
func main() {
mflag.BoolVar(&useScheduler, []string{"scheduler"}, false, "Use scheduler to distribute tests across shards")
mflag.BoolVar(&runParallel, []string{"parallel"}, false, "Run tests in parallel on hosts where possible")
mflag.BoolVar(&verbose, []string{"v"}, false, "Print output from all tests (Also enabled via DEBUG=1)")
mflag.StringVar(&schedulerHost, []string{"scheduler-host"}, defaultSchedulerHost, "Hostname of scheduler.")
mflag.Parse()
if len(os.Getenv("DEBUG")) > 0 {
verbose = true
}
tests, err := getTests(mflag.Args())
if err != nil {
fmt.Printf("Error parsing tests: %v\n", err)
os.Exit(1)
}
hosts := strings.Fields(os.Getenv("HOSTS"))
maxHosts := len(hosts)
if maxHosts == 0 {
fmt.Print("No HOSTS specified.\n")
os.Exit(1)
}
var errored bool
if runParallel {
errored = parallel(tests, hosts)
} else {
errored = sequential(tests, hosts)
}
if errored {
os.Exit(1)
}
}
开发者ID:pauloheck,项目名称:scope,代码行数:35,代码来源:runner.go
示例5: main
func main() {
mflag.BoolVar(&useScheduler, []string{"scheduler"}, false, "Use scheduler to distribute tests across shards")
mflag.BoolVar(&runParallel, []string{"parallel"}, false, "Run tests in parallel on hosts where possible")
mflag.Parse()
tests, err := getTests(mflag.Args())
if err != nil {
fmt.Printf("Error parsing tests: %v\n", err)
os.Exit(1)
}
hosts := strings.Fields(os.Getenv("HOSTS"))
maxHosts := len(hosts)
if maxHosts == 0 {
fmt.Print("No HOSTS specified.\n")
os.Exit(1)
}
var errored bool
if runParallel {
errored = parallel(tests, hosts)
} else {
errored = sequential(tests, hosts)
}
if errored {
os.Exit(1)
}
}
开发者ID:paladin74,项目名称:weave,代码行数:29,代码来源:runner.go
示例6: init
func init() {
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display help")
flag.BoolVar(&verbose, []string{"v", "-verbose"}, false, "Switch to verbose output")
flag.Var(&keys, []string{"k", "-key-file"}, "Private key with which to sign")
flag.Parse()
if kk := flag.Lookup("-k"); kk != nil {
keys = *kk.Value.(*opts.ListOpts)
}
}
开发者ID:shaded-enmity,项目名称:docker-tar-push,代码行数:9,代码来源:main.go
示例7: main
func main() {
var (
justVersion bool
logLevel = "info"
c proxy.Config
withDNS bool
)
c.Version = version
mflag.BoolVar(&justVersion, []string{"#version", "-version"}, false, "print version and exit")
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
mflagext.ListVar(&c.ListenAddrs, []string{"H"}, nil, "addresses on which to listen")
mflag.StringVar(&c.HostnameFromLabel, []string{"-hostname-from-label"}, "", "Key of container label from which to obtain the container's hostname")
mflag.StringVar(&c.HostnameMatch, []string{"-hostname-match"}, "(.*)", "Regexp pattern to apply on container names (e.g. '^aws-[0-9]+-(.*)$')")
mflag.StringVar(&c.HostnameReplacement, []string{"-hostname-replacement"}, "$1", "Expression to generate hostnames based on matches from --hostname-match (e.g. 'my-app-$1')")
mflag.BoolVar(&c.RewriteInspect, []string{"-rewrite-inspect"}, false, "Rewrite 'inspect' calls to return the weave network settings (if attached)")
mflag.BoolVar(&c.NoDefaultIPAM, []string{"#-no-default-ipam", "-no-default-ipalloc"}, false, "do not automatically allocate addresses for containers without a WEAVE_CIDR")
mflag.BoolVar(&c.NoRewriteHosts, []string{"-no-rewrite-hosts"}, false, "do not automatically rewrite /etc/hosts. Use if you need the docker IP to remain in /etc/hosts")
mflag.StringVar(&c.TLSConfig.CACert, []string{"#tlscacert", "-tlscacert"}, "", "Trust certs signed only by this CA")
mflag.StringVar(&c.TLSConfig.Cert, []string{"#tlscert", "-tlscert"}, "", "Path to TLS certificate file")
mflag.BoolVar(&c.TLSConfig.Enabled, []string{"#tls", "-tls"}, false, "Use TLS; implied by --tlsverify")
mflag.StringVar(&c.TLSConfig.Key, []string{"#tlskey", "-tlskey"}, "", "Path to TLS key file")
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
mflag.BoolVar(&withDNS, []string{"#-with-dns", "#w"}, false, "option removed")
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
mflag.BoolVar(&c.NoMulticastRoute, []string{"-no-multicast-route"}, false, "do not add a multicast route via the weave interface when attaching containers")
mflag.Parse()
if justVersion {
fmt.Printf("weave proxy %s\n", version)
os.Exit(0)
}
SetLogLevel(logLevel)
Log.Infoln("weave proxy", version)
Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " "))
if withDNS {
Log.Warning("--with-dns option has been removed; DNS is on by default")
}
c.Image = getenv("EXEC_IMAGE", "weaveworks/weaveexec")
c.DockerBridge = getenv("DOCKER_BRIDGE", "docker0")
c.DockerHost = getenv("DOCKER_HOST", "unix:///var/run/docker.sock")
c.ProcPath = getenv("PROCFS", "/proc")
p, err := proxy.NewProxy(c)
if err != nil {
Log.Fatalf("Could not start proxy: %s", err)
}
defer p.Stop()
listeners := p.Listen()
p.AttachExistingContainers()
go p.Serve(listeners)
go p.ListenAndServeStatus("/home/weave/status.sock")
SignalHandlerLoop()
}
开发者ID:brb,项目名称:weave,代码行数:60,代码来源:main.go
示例8: init
func init() {
logrus.SetOutput(os.Stdout)
logrus.SetLevel(logrus.DebugLevel)
mflag.BoolVar(&master, []string{"m", "-master", "#mt"}, false, "if the master server.")
mflag.BoolVar(&help, []string{"h", "-help", "#hhhhelp"}, false, "show help.")
mflag.StringVar(&env, []string{"e", "-env"}, "test", "which config env to run.")
// mflag.BoolVar(&picture, []string{"i", "-image"}, false, "download the picture that go throuth.")
mflag.StringVar(&conffile, []string{"f", "-config"}, "", "point a config file.default is config/config.json.")
mflag.Parse()
}
开发者ID:qwding,项目名称:go_distributed_spider,代码行数:11,代码来源:distribute.go
示例9: init
func init() {
flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
flag.BoolVar(&b, []string{"b", "#bal", "#bol", "-bal"}, false, "a simple bool")
flag.BoolVar(&b, []string{"g", "#gil"}, false, "a simple bool")
flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool")
flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer")
flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3")
flag.Parse()
}
开发者ID:maxim28,项目名称:docker,代码行数:11,代码来源:example.go
示例10: InstallFlags
// InstallFlags adds command-line options to the top-level flag parser for
// the current process.
// Subsequent calls to `flag.Parse` will populate config with values parsed
// from the command-line.
func (config *Config) InstallFlags() {
flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Root of the Docker runtime")
flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable addition of iptables rules")
flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
flag.BoolVar(&config.EnableIpMasq, []string{"-ip-masq"}, true, "Enable IP masquerading")
flag.BoolVar(&config.EnableIPv6, []string{"-ipv6"}, false, "Enable IPv6 networking")
flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Specify network bridge IP")
flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a network bridge")
flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs")
flag.StringVar(&config.FixedCIDRv6, []string{"-fixed-cidr-v6"}, "", "IPv6 subnet for fixed IPs")
flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Storage driver to use")
flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Exec driver to use")
flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support")
flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU")
flag.StringVar(&config.SocketGroup, []string{"G", "-group"}, "docker", "Group for the unix socket")
flag.BoolVar(&config.EnableCors, []string{"#api-enable-cors", "#-api-enable-cors"}, false, "Enable CORS headers in the remote API, this is deprecated by --api-cors-header")
flag.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", "Set CORS headers in the remote API")
opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP when binding container ports")
opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
// FIXME: why the inconsistency between "hosts" and "sockets"?
opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "DNS server to use")
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "DNS search domains to use")
opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon")
config.Ulimits = make(map[string]*ulimit.Ulimit)
opts.UlimitMapVar(config.Ulimits, []string{"-default-ulimit"}, "Set default ulimits for containers")
flag.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", "Containers logging driver(json-file/none)")
}
开发者ID:pierknueppel,项目名称:docker,代码行数:34,代码来源:config.go
示例11: InstallCommonFlags
func (config *Config) InstallCommonFlags() {
flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, "Path to use for daemon PID file")
flag.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, "Root of the Docker runtime")
flag.StringVar(&config.ExecRoot, []string{"-exec-root"}, "/var/run/docker", "Root of the Docker execdriver")
flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
flag.BoolVar(&config.Bridge.EnableIPTables, []string{"#iptables", "-iptables"}, true, "Enable addition of iptables rules")
flag.BoolVar(&config.Bridge.EnableIPForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
flag.BoolVar(&config.Bridge.EnableIPMasq, []string{"-ip-masq"}, true, "Enable IP masquerading")
flag.BoolVar(&config.Bridge.EnableIPv6, []string{"-ipv6"}, false, "Enable IPv6 networking")
flag.StringVar(&config.Bridge.IP, []string{"#bip", "-bip"}, "", "Specify network bridge IP")
flag.StringVar(&config.Bridge.Iface, []string{"b", "-bridge"}, "", "Attach containers to a network bridge")
flag.StringVar(&config.Bridge.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs")
flag.StringVar(&config.Bridge.FixedCIDRv6, []string{"-fixed-cidr-v6"}, "", "IPv6 subnet for fixed IPs")
flag.StringVar(&config.Bridge.DefaultGatewayIPv4, []string{"-default-gateway"}, "", "Container default gateway IPv4 address")
flag.StringVar(&config.Bridge.DefaultGatewayIPv6, []string{"-default-gateway-v6"}, "", "Container default gateway IPv6 address")
flag.BoolVar(&config.Bridge.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Storage driver to use")
flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, defaultExec, "Exec driver to use")
flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU")
flag.BoolVar(&config.EnableCors, []string{"#api-enable-cors", "#-api-enable-cors"}, false, "Enable CORS headers in the remote API, this is deprecated by --api-cors-header")
flag.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", "Set CORS headers in the remote API")
opts.IPVar(&config.Bridge.DefaultIP, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP when binding container ports")
// FIXME: why the inconsistency between "hosts" and "sockets"?
opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "DNS server to use")
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "DNS search domains to use")
opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon")
flag.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", "Default driver for container logs")
opts.LogOptsVar(config.LogConfig.Config, []string{"-log-opt"}, "Set log driver options")
flag.BoolVar(&config.Bridge.EnableUserlandProxy, []string{"-userland-proxy"}, true, "Use userland proxy for loopback traffic")
}
开发者ID:jgatkinsn,项目名称:docker,代码行数:31,代码来源:config.go
示例12: installFlags
func installFlags() {
flag.BoolVar(&flDebug, []string{"D", "-debug"}, false, "Enable debug mode")
flag.StringVar(&flLogLevel, []string{"l", "-log-level"}, "info", "Set the logging level")
flag.StringVar(&root, []string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the graph driver")
opts.ListVar(&graphOptions, []string{"-storage-opt"}, "Set storage driver options")
flag.StringVar(&graphDriver, []string{"s", "-storage-driver"}, "", "Force the runtime to use a specific storage driver")
}
开发者ID:hustcat,项目名称:docker-graph-driver,代码行数:7,代码来源:main.go
示例13: init
func init() {
flag.StringVar(&tplfile, []string{"t", "-template"}, "", "Template file name for produce config file.")
flag.StringVar(&appName, []string{"-app"}, "appname", "App name for upstream/logfile name/conf name/consul key.")
flag.StringVar(&output, []string{"o", "-output"}, "appname.conf", "Config file name for save config file.")
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display the help")
flag.Parse()
}
开发者ID:soarpenguin,项目名称:go-scripts,代码行数:7,代码来源:namedtpl.go
示例14: init
func init() {
// Check https://github.com/docker/docker/blob/master/pkg/mflag/example/example.go
flag.StringVar(&path, []string{"p", "#pathhidden", "-path"}, "", "path to traverse")
flag.StringVar(&path, []string{"n", "#namehidden", "-name"}, "", "name to traverse")
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
flag.Parse()
}
开发者ID:klashxx,项目名称:gofind,代码行数:7,代码来源:gofind.go
示例15: init
func init() {
log.SetFormatter(&log.JSONFormatter{})
// Output to stderr instead of stdout, could also be a file.
log.SetOutput(os.Stderr)
// Only log the warning severity or above.
log.SetLevel(log.WarnLevel)
// XXX print a warning that this tool is not stable yet
fmt.Fprintln(os.Stderr, "WARNING: this tool is not stable yet, and should only be used for testing!")
flag.BoolVar(&timeout, []string{"t", "-timeout"}, timeout, "allow timeout on the registry session")
flag.BoolVar(&debug, []string{"D", "-debug"}, debug, "debugging output")
flag.StringVar(&outputStream, []string{"o", "-output"}, outputStream, "output to file (default stdout)")
rOptions.InstallFlags()
}
开发者ID:smunilla,项目名称:docker-utils,代码行数:18,代码来源:main.go
示例16: init
func init() {
flag.StringVar(&tplfile, []string{"t", "-template"}, "server.conf.template", "Template file name for produce config file.")
flag.StringVar(&appName, []string{"-app"}, "appname", "App name for upstream/logfile name/conf name/consul key.")
flag.StringVar(&consulIp, []string{"c", "-consul"}, "10.10.10.10:8500", "Consul server 'url:port' for get upstream info.")
flag.StringVar(&virtualIp, []string{"v", "-virtualip"}, "0.0.0.0:81,0.0.0.1", "Virtual IP/PORT list for this app.")
flag.StringVar(&output, []string{"o", "-output"}, "appname.conf", "Config file name for save config file.")
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display the help")
flag.Parse()
}
开发者ID:soarpenguin,项目名称:go-scripts,代码行数:9,代码来源:tplparse.go
示例17: InstallCommonFlags
// InstallCommonFlags adds command-line options to the top-level flag parser for
// the current process.
// Subsequent calls to `flag.Parse` will populate config with values parsed
// from the command-line.
func (config *Config) InstallCommonFlags() {
opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
opts.ListVar(&config.ExecOptions, []string{"-exec-opt"}, "Set exec driver options")
flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, "Path to use for daemon PID file")
flag.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, "Root of the Docker runtime")
flag.StringVar(&config.ExecRoot, []string{"-exec-root"}, "/var/run/docker", "Root of the Docker execdriver")
flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Storage driver to use")
flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, defaultExec, "Exec driver to use")
flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU")
flag.BoolVar(&config.EnableCors, []string{"#api-enable-cors", "#-api-enable-cors"}, false, "Enable CORS headers in the remote API, this is deprecated by --api-cors-header")
flag.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", "Set CORS headers in the remote API")
// FIXME: why the inconsistency between "hosts" and "sockets"?
opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "DNS server to use")
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "DNS search domains to use")
opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon")
flag.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", "Default driver for container logs")
opts.LogOptsVar(config.LogConfig.Config, []string{"-log-opt"}, "Set log driver options")
}
开发者ID:fengbaicanhe,项目名称:docker,代码行数:23,代码来源:config.go
示例18: InstallFlags
// InstallFlags adds command-line options to the top-level flag parser for
// the current process.
// Subsequent calls to `flag.Parse` will populate config with values parsed
// from the command-line.
func (config *Config) InstallFlags() {
flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the Docker runtime")
flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated infavor of --restart policies on docker run")
flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable Docker's addition of iptables rules")
flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")
flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support. SELinux does not presently support the BTRFS storage driver")
flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU\nif no value is provided: default to the default route MTU or 1500 if no default route is available")
opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP address to use when binding container ports")
opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
// FIXME: why the inconsistency between "hosts" and "sockets"?
opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "Force Docker to use specific DNS servers")
opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
}
开发者ID:andrew2king,项目名称:docker,代码行数:23,代码来源:config.go
示例19: main
func main() {
var (
justVersion bool
logLevel = "info"
c = proxy.Config{ListenAddrs: []string{}}
)
c.Version = version
mflag.BoolVar(&justVersion, []string{"#version", "-version"}, false, "print version and exit")
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
mflagext.ListVar(&c.ListenAddrs, []string{"H"}, nil, "addresses on which to listen")
mflag.StringVar(&c.HostnameFromLabel, []string{"-hostname-from-label"}, "", "Key of container label from which to obtain the container's hostname")
mflag.StringVar(&c.HostnameMatch, []string{"-hostname-match"}, "(.*)", "Regexp pattern to apply on container names (e.g. '^aws-[0-9]+-(.*)$')")
mflag.StringVar(&c.HostnameReplacement, []string{"-hostname-replacement"}, "$1", "Expression to generate hostnames based on matches from --hostname-match (e.g. 'my-app-$1')")
mflag.BoolVar(&c.RewriteInspect, []string{"-rewrite-inspect"}, false, "Rewrite 'inspect' calls to return the weave network settings (if attached)")
mflag.BoolVar(&c.NoDefaultIPAM, []string{"#-no-default-ipam", "-no-default-ipalloc"}, false, "do not automatically allocate addresses for containers without a WEAVE_CIDR")
mflag.BoolVar(&c.NoRewriteHosts, []string{"-no-rewrite-hosts"}, false, "do not automatically rewrite /etc/hosts. Use if you need the docker IP to remain in /etc/hosts")
mflag.StringVar(&c.TLSConfig.CACert, []string{"#tlscacert", "-tlscacert"}, "", "Trust certs signed only by this CA")
mflag.StringVar(&c.TLSConfig.Cert, []string{"#tlscert", "-tlscert"}, "", "Path to TLS certificate file")
mflag.BoolVar(&c.TLSConfig.Enabled, []string{"#tls", "-tls"}, false, "Use TLS; implied by --tls-verify")
mflag.StringVar(&c.TLSConfig.Key, []string{"#tlskey", "-tlskey"}, "", "Path to TLS key file")
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
mflag.Parse()
if justVersion {
fmt.Printf("weave proxy %s\n", version)
os.Exit(0)
}
if c.WithDNS && c.WithoutDNS {
Log.Fatalf("Cannot use both '--with-dns' and '--without-dns' flags")
}
SetLogLevel(logLevel)
Log.Infoln("weave proxy", version)
Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " "))
p, err := proxy.NewProxy(c)
if err != nil {
Log.Fatalf("Could not start proxy: %s", err)
}
listeners := p.Listen()
p.AttachExistingContainers()
go p.Serve(listeners)
go p.ListenAndServeStatus("/home/weave/status.sock")
SignalHandlerLoop()
}
开发者ID:ravisinghsfbay,项目名称:weave,代码行数:52,代码来源:main.go
示例20: InstallFlags
// InstallFlags adds command-line options to the top-level flag parser for
// the current process.
// Subsequent calls to `flag.Parse` will populate config with values parsed
// from the command-line.
func (config *Config) InstallFlags() {
// First handle install flags which are consistent cross-platform
config.InstallCommonFlags()
// Then platform-specific install flags
opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
opts.ListVar(&config.ExecOptions, []string{"-exec-opt"}, "Set exec driver options")
flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support")
flag.StringVar(&config.SocketGroup, []string{"G", "-group"}, "docker", "Group for the unix socket")
config.Ulimits = make(map[string]*ulimit.Ulimit)
opts.UlimitMapVar(config.Ulimits, []string{"-default-ulimit"}, "Set default ulimits for containers")
}
开发者ID:colebrumley,项目名称:docker,代码行数:16,代码来源:config_linux.go
注:本文中的github.com/docker/docker/pkg/mflag.BoolVar函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论