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 }
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} }
func initBucketClient() *http.Client { t := cbauth.WrapHTTPTransport(http.DefaultTransport, nil) rv := *http.DefaultClient rv.Transport = t return &rv }