func NewClient(endpoint string) (*Client, error) { authKey := os.Getenv("TEST_RUNNER_AUTH_KEY") if authKey == "" { return nil, errors.New("missing TEST_RUNNER_AUTH_KEY environment variable") } httpClient := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{ServerName: "ci.flynn.io"}}} client := &Client{ Client: &httpclient.Client{ ErrNotFound: ErrNotFound, URL: endpoint, Key: authKey, HTTP: httpClient, }, } var cluster tc.Cluster if err := client.Get("", &cluster); err != nil { return nil, err } client.cluster = &cluster client.size = cluster.Size() return client, nil }