"net/http"
"net/url"
"os"
+ "strings"
"time"
)
type Client struct {
// HTTP client used to make requests. If nil,
// DefaultSecureClient or InsecureHTTPClient will be used.
- Client *http.Client
+ Client *http.Client `json:"-"`
// Hostname (or host:port) of Arvados API server.
APIHost string
// Accept unverified certificates. This works only if the
// Client field is nil: otherwise, it has no effect.
Insecure bool
+
+ // Override keep service discovery with a list of base
+ // URIs. (Currently there are no Client methods for
+ // discovering keep services so this is just a convenience for
+ // callers who use a Client to initialize an
+ // arvadosclient.ArvadosClient.)
+ KeepServiceURIs []string `json:",omitempty"`
}
// The default http.Client used by a Client with Insecure==true and
// client with the API endpoint and credentials given by the
// ARVADOS_API_* environment variables.
func NewClientFromEnv() *Client {
+ var svcs []string
+ if s := os.Getenv("ARVADOS_KEEP_SERVICES"); s != "" {
+ svcs = strings.Split(s, " ")
+ }
return &Client{
- APIHost: os.Getenv("ARVADOS_API_HOST"),
- AuthToken: os.Getenv("ARVADOS_API_TOKEN"),
- Insecure: os.Getenv("ARVADOS_API_HOST_INSECURE") != "",
+ APIHost: os.Getenv("ARVADOS_API_HOST"),
+ AuthToken: os.Getenv("ARVADOS_API_TOKEN"),
+ Insecure: os.Getenv("ARVADOS_API_HOST_INSECURE") != "",
+ KeepServiceURIs: svcs,
}
}