openService opens a service
(c star.Context)
| 132 | |
| 133 | // openService opens a service |
| 134 | func openService(c star.Context) (blobcache.Service, error) { |
| 135 | apiURL := c.Env[bcclient.EnvBlobcacheAPI] |
| 136 | if apiURL == "" { |
| 137 | // TODO: star does not properly include Env vars in Main |
| 138 | // This should not be required. |
| 139 | apiURL = os.Getenv(bcclient.EnvBlobcacheAPI) |
| 140 | } |
| 141 | if apiURL == "" { |
| 142 | logctx.Warnf(c.Context, "%s not set, using default=%s", bcclient.EnvBlobcacheAPI, bcclient.DefaultEndpoint) |
| 143 | apiURL = bcclient.DefaultEndpoint |
| 144 | } |
| 145 | return bcclient.NewClient(apiURL), nil |
| 146 | } |
| 147 | |
| 148 | func RunTest(t testing.TB, env map[string]string, calledAs string, args []string, stdin *bufio.Reader, stdout *bufio.Writer, stderr *bufio.Writer) { |
| 149 | if stdin == nil { |