INNER CODE UNIT · Go
makeHTTPTransport
jupyterhub/zero-to-jupyterhub-k8s · images/image-awaiter/main.go:24
func makeHTTPTransport(debug bool, caPath string, clientCertPath string, clientKeyPath string) (*http.Transport, error) {
idleConnTimeout := 30 * 60 * time.Second
// If you debug through a kubectl proxy, certificates etc. isn't required
if debug {
transportPtr := &http.Transport{IdleConnTimeout: idleConnTimeout}
return transportPtr, nil
}
// Load client cert/key if they exist
certificates := []tls.Certificate{}
if clientCertPath != "" && clientKeyPath != "" {
cert, err := tls.LoadX509KeyPair(clientCertPath, clientKeyPath)
if err != nil {
return nil, err
}
certificates = append(certificates, cert)