本文整理匯總了Golang中github.com/flynn/flynn/bootstrap.Config.ClusterURL方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.ClusterURL方法的具體用法?Golang Config.ClusterURL怎麽用?Golang Config.ClusterURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flynn/flynn/bootstrap.Config
的用法示例。
在下文中一共展示了Config.ClusterURL方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: runBootstrap
func runBootstrap(args *docopt.Args) error {
log.SetFlags(log.Lmicroseconds)
logf := textLogger
if args.Bool["--json"] {
logf = jsonLogger
}
var cfg bootstrap.Config
manifestFile := args.String["<manifest>"]
if manifestFile == "" {
manifestFile = "/etc/flynn/bootstrap-manifest.json"
}
var steps []string
if s := args.String["--steps"]; s != "" {
steps = strings.Split(s, ",")
}
var err error
manifest, err = readBootstrapManifest(manifestFile)
if err != nil {
return fmt.Errorf("Error reading manifest: %s", err)
}
if n := args.String["--min-hosts"]; n != "" {
if cfg.MinHosts, err = strconv.Atoi(n); err != nil || cfg.MinHosts < 1 {
return fmt.Errorf("invalid --min-hosts value")
}
}
cfg.Timeout, err = strconv.Atoi(args.String["--timeout"])
if err != nil {
return fmt.Errorf("invalid --timeout value")
}
if ipList := args.String["--peer-ips"]; ipList != "" {
cfg.IPs = strings.Split(ipList, ",")
if cfg.MinHosts == 0 {
cfg.MinHosts = len(cfg.IPs)
}
}
if cfg.MinHosts == 0 {
cfg.MinHosts = 1
}
cfg.Singleton = cfg.MinHosts == 1
if s := os.Getenv("SINGLETON"); s != "" {
cfg.Singleton = s == "true"
}
ch := make(chan *bootstrap.StepInfo)
done := make(chan struct{})
var last error
go func() {
for si := range ch {
logf(si)
last = si.Err
}
close(done)
}()
cfg.ClusterURL = args.String["--discovery"]
if bf := args.String["--from-backup"]; bf != "" {
err = runBootstrapBackup(manifest, bf, ch, cfg)
} else {
err = bootstrap.Run(manifest, ch, cfg, steps)
}
<-done
if err != nil && last != nil && err.Error() == last.Error() {
return ErrAlreadyLogged{err}
}
return err
}