Ejemplo n.º 1
0
func initFlags(c *config) {
	pflag.StringSliceVar(&c.etcdServers, "etcd-servers", []string{}, "The comma-seprated list of etcd servers to use")
	pflag.StringVar(&c.key, "key", "", "The key to use for the lock")
	pflag.StringVar(&c.whoami, "whoami", "", "The name to use for the reservation.  If empty use os.Hostname")
	pflag.Uint64Var(&c.ttl, "ttl-secs", 30, "The time to live for the lock.")
	pflag.StringVar(&c.src, "source-file", "", "The source file to copy from.")
	pflag.StringVar(&c.dest, "dest-file", "", "The destination file to copy to.")
	pflag.DurationVar(&c.sleep, "sleep", 5*time.Second, "The length of time to sleep between checking the lock.")
}
Ejemplo n.º 2
0
func initFlags(c *config) {
	pflag.StringVar(&c.etcdServers, "etcd-servers", "", "List of etcd servers to watch (http://ip:port), comma separated. Mutually exclusive with -etcd-config")
	pflag.StringVar(&c.etcdConfigFile, "etcd-config", "", "The config file for the etcd client. Mutually exclusive with -etcd-servers.")
	pflag.StringVar(&c.key, "key", "", "The key to use for the lock")
	pflag.StringVar(&c.whoami, "whoami", "", "The name to use for the reservation.  If empty use os.Hostname")
	pflag.Uint64Var(&c.ttl, "ttl-secs", 30, "The time to live for the lock.")
	pflag.StringVar(&c.src, "source-file", "", "The source file to copy from.")
	pflag.StringVar(&c.dest, "dest-file", "", "The destination file to copy to.")
	pflag.DurationVar(&c.sleep, "sleep", 5*time.Second, "The length of time to sleep between checking the lock.")
}
Ejemplo n.º 3
0
func init() {
	pflag.StringVar(&formula, "price-formula", "static", "What price formular to use? static, random, old, young")
	pflag.Float32Var(&formulaStaticPrice, "price-static", 1.0, "Price for static formular")
	pflag.Float32Var(&formulaDefaultPrice, "price-default", 1.0, "Default Price for old/young formular")
	pflag.Float32Var(&formulaOldPrice, "price-old", 1.0, "Age Price for old formular")
	pflag.Float32Var(&formulaYoungPrice, "price-young", 1.0, "Age Price for young formular")
	pflag.DurationVar(&formulaOldAge, "price-old-age", 6*30*24*time.Hour, "Minimum age before start bidding price-old")
	pflag.DurationVar(&formulaYoungAge, "price-young-age", 60*24*time.Hour, "Maximum age before stop bidding price-old")

	pflag.StringVar(&volumePath, "volume", "./lib", "What files to sync")

	pflag.StringVar(&fsConfig.Addr, "http-addr", "127.0.0.1", "IP to listen on. Must be resolvable by all peers")
	pflag.IntVar(&fsConfig.Port, "http-port", 8080, "Port for HTTP FileServer")

	pflag.IntVar(&p2pConfig.BindPort, "bind-port", 8000, "The port to bind to")
	pflag.StringVar(&p2pConfig.Name, "name", "mediasyncer", "The name of this process. Must be unique for the memberlist cluster")

	pflag.BoolVar(&printNetworkMessages, "debug", false, "Print network messages received/sent")
}
Ejemplo n.º 4
0
func initFlags(c *config) {
	pflag.StringSliceVar(&c.etcdServers, "etcd-servers", []string{}, "The comma-seprated list of etcd servers to use")
	pflag.BoolVar(&c.etcdSecure, "etcd-secure", false, "Set to true if etcd has https")
	pflag.StringVar(&c.etcdCertfile, "etcd-certfile", "", "Etcd TLS cert file, needed if etcd-secure")
	pflag.StringVar(&c.etcdKeyfile, "etcd-keyfile", "", "Etcd TLS key file, needed if etcd-secure")
	pflag.StringVar(&c.etcdCafile, "etcd-cafile", "", "Etcd CA file, needed if etcd-secure")
	pflag.StringVar(&c.key, "key", "", "The key to use for the lock")
	pflag.StringVar(&c.whoami, "whoami", "", "The name to use for the reservation.  If empty use os.Hostname")
	pflag.Uint64Var(&c.ttl, "ttl-secs", 30, "The time to live for the lock.")
	pflag.StringVar(&c.src, "source-file", "", "The source file to copy from.")
	pflag.StringVar(&c.dest, "dest-file", "", "The destination file to copy to.")
	pflag.DurationVar(&c.sleep, "sleep", 5*time.Second, "The length of time to sleep between checking the lock.")
}
Ejemplo n.º 5
0
func initFlags() {
	flag.IntVarP(&options.Port, "port", "p", 80, "The port to listen on")
	flag.StringVarP(&options.StaticDir, "www", "w", ".", "Directory to serve static files from")
	flag.StringVar(&options.StaticPrefix, "www-prefix", "/", "Prefix to serve static files on")
	flag.DurationVar(&options.StaticCacheMaxAge, "max-age", 0, "Set the Cache-Control header for static content with the max-age set to this value, e.g. 24h. Must confirm to http://golang.org/pkg/time/#ParseDuration")
	flag.StringVarP(&options.DefaultPage, "default-page", "d", "", "Default page to send if page not found")
	flag.VarP(&options.Services, "service", "s", "The Kubernetes services to proxy to in the form \"<prefix>=<serviceUrl>\"")
	flag.VarP(&options.Configs, "config-file", "c", "The configuration files to create in the form \"<template>=<output>\"")
	flag.Var(&options.CACerts, "ca-cert", "CA certs used to verify proxied server certificates")
	flag.StringVar(&options.TlsCertFile, "tls-cert", "", "Certificate file to use to serve using TLS")
	flag.StringVar(&options.TlsKeyFile, "tls-key", "", "Certificate file to use to serve using TLS")
	flag.BoolVar(&options.SkipCertValidation, "skip-cert-validation", false, "Skip remote certificate validation - dangerous!")
	flag.BoolVarP(&options.AccessLogging, "access-logging", "l", false, "Enable access logging")
	flag.BoolVar(&options.CompressHandler, "compress", false, "Enable gzip/deflate response compression")
	flag.BoolVar(&options.FailOnUnknownServices, "fail-on-unknown-services", false, "Fail on unknown services in DNS")
	flag.BoolVar(&options.ServeWww, "serve-www", true, "Whether to serve static content")
	flag.Parse()
}