| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package bootstrap | 5 package bootstrap |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "github.com/luci/luci-go/client/environ" | 10 "github.com/luci/luci-go/client/environ" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return nil, fmt.Errorf("bootstrap: failed to create stre
am client [%s]: %s", p, err) | 67 return nil, fmt.Errorf("bootstrap: failed to create stre
am client [%s]: %s", p, err) |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 return bs, nil | 71 return bs, nil |
| 72 } | 72 } |
| 73 | 73 |
| 74 func (bs *Bootstrap) initializeClient(v string, reg *streamclient.Registry) erro
r { | 74 func (bs *Bootstrap) initializeClient(v string, reg *streamclient.Registry) erro
r { |
| 75 c, err := reg.NewClient(v) | 75 c, err := reg.NewClient(v) |
| 76 if err != nil { | 76 if err != nil { |
| 77 » » return errors.Annotate(err).Reason("bootstrap: failed to create
stream client [%(config)s]").D("config", v).Err() | 77 » » return errors.Annotate(err, "bootstrap: failed to create stream
client [%s]", v).Err() |
| 78 } | 78 } |
| 79 bs.Client = c | 79 bs.Client = c |
| 80 return nil | 80 return nil |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Get loads a Bootstrap instance from the environment. It will return an error | 83 // Get loads a Bootstrap instance from the environment. It will return an error |
| 84 // if the bootstrap data is invalid, and will return ErrNotBootstrapped if the | 84 // if the bootstrap data is invalid, and will return ErrNotBootstrapped if the |
| 85 // current process is not bootstrapped. | 85 // current process is not bootstrapped. |
| 86 func Get() (*Bootstrap, error) { | 86 func Get() (*Bootstrap, error) { |
| 87 return getFromEnv(environ.Get(), streamclient.GetDefaultRegistry()) | 87 return getFromEnv(environ.Get(), streamclient.GetDefaultRegistry()) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 111 if bs.Prefix == "" { | 111 if bs.Prefix == "" { |
| 112 return "", errors.New("no prefix is configured") | 112 return "", errors.New("no prefix is configured") |
| 113 } | 113 } |
| 114 | 114 |
| 115 paths := make([]types.StreamPath, len(streams)) | 115 paths := make([]types.StreamPath, len(streams)) |
| 116 for i, s := range streams { | 116 for i, s := range streams { |
| 117 paths[i] = bs.Prefix.Join(types.StreamName(s.Properties().Name)) | 117 paths[i] = bs.Prefix.Join(types.StreamName(s.Properties().Name)) |
| 118 } | 118 } |
| 119 return bs.GetViewerURL(paths...) | 119 return bs.GetViewerURL(paths...) |
| 120 } | 120 } |
| OLD | NEW |