Exemplo n.º 1
0
func initCbAuth(url string) (*cb.Client, error) {

	transport := cbauth.WrapHTTPTransport(cb.HTTPTransport, nil)
	cb.HTTPClient.Transport = transport

	client, err := cb.ConnectWithAuth(url, cbauth.NewAuthHandler(nil))
	if err != nil {
		return nil, err
	}

	logging.Infof(" Initialization of cbauth succeeded ")

	return &client, nil
}
Exemplo n.º 2
0
func initDefaultStore() *store {
	c := *http.DefaultClient
	c.Transport = cbauth.WrapHTTPTransport(http.DefaultTransport, nil)

	authURL := os.Getenv("CBAUTH_REVRPC_URL")
	u, err := url.Parse(authURL)
	if err == nil {
		u.RawQuery = ""
		u.Fragment = ""
		u.Path = "/_metakv"
		u.User = nil
	}
	return &store{url: u, client: &c}
}
Exemplo n.º 3
0
func initBucketClient() *http.Client {
	t := cbauth.WrapHTTPTransport(http.DefaultTransport, nil)
	rv := *http.DefaultClient
	rv.Transport = t
	return &rv
}