func DefaultConfig() *Config {
	config := &Config{
		Address:    "http://127.0.0.1:8080",
		HTTPClient: cleanhttp.DefaultClient(),
		TLSConfig:  &TLSConfig{},
	}
	transport := config.HTTPClient.Transport.(*http.Transport)
	transport.TLSHandshakeTimeout = 10 * time.Second
	transport.TLSClientConfig = &tls.Config{
		MinVersion: tls.VersionTLS12,
	}

	if addr := os.Getenv("LIBRA_ADDR"); addr != "" {
		config.Address = addr
	}
	if auth := os.Getenv("LIBRA_HTTP_AUTH"); auth != "" {
		var username, password string
		if strings.Contains(auth, ":") {
			split := strings.SplitN(auth, ":", 2)
			username = split[0]
			password = split[1]
		} else {
			username = auth
		}

		config.HTTPAuth = &HTTPBasicAuth{
			Username: username,
			Password: password,
		}
	}

	// Read TLS specific env vars
	if v := os.Getenv("LIBRA_CACERT"); v != "" {
		config.TLSConfig.CACert = v
	}
	if v := os.Getenv("LIBRA_CAPATH"); v != "" {
		config.TLSConfig.CAPath = v
	}
	if v := os.Getenv("LIBRA_CLIENT_CERT"); v != "" {
		config.TLSConfig.ClientCert = v
	}
	if v := os.Getenv("LIBRA_CLIENT_KEY"); v != "" {
		config.TLSConfig.ClientKey = v
	}
	if v := os.Getenv("LIBRA_SKIP_VERIFY"); v != "" {
		if insecure, err := strconv.ParseBool(v); err == nil {
			config.TLSConfig.Insecure = insecure
		}
	}

	return config
}
// DefaultConfig returns a default configuration for the client
DefaultConfig returns a default configuration for the client
// DefaultConfig returns a default configuration for the client
func DefaultConfig() *Config {
	config := &Config{
		Address:    "http://127.0.0.1:8080",
		HTTPClient: cleanhttp.DefaultClient(),
		TLSConfig:  &TLSConfig{},
	}
	transport := config.HTTPClient.Transport.(*http.Transport)
	transport.TLSHandshakeTimeout = 10 * time.Second
	transport.TLSClientConfig = &tls.Config{
		MinVersion: tls.VersionTLS12,
	}
	if addr := os.Getenv("LIBRA_ADDR"); addr != "" {
		config.Address = addr
	}
	if auth := os.Getenv("LIBRA_HTTP_AUTH"); auth != "" {
		var username, password string
		if strings.Contains(auth, ":") {
			split := strings.SplitN(auth, ":", 2)
			username = split[0]
			password = split[1]
		} else {
			username = auth
		}
		config.HTTPAuth = &HTTPBasicAuth{
			Username: username,
			Password: password,
		}
	}
	if v := os.Getenv("LIBRA_CACERT"); v != "" {
		config.TLSConfig.CACert = v
	}
	if v := os.Getenv("LIBRA_CAPATH"); v != "" {
		config.TLSConfig.CAPath = v
	}
	if v := os.Getenv("LIBRA_CLIENT_CERT"); v != "" {
		config.TLSConfig.ClientCert = v
	}
	if v := os.Getenv("LIBRA_CLIENT_KEY"); v != "" {
		config.TLSConfig.ClientKey = v
	}
	if v := os.Getenv("LIBRA_SKIP_VERIFY"); v != "" {
		if insecure, err := strconv.ParseBool(v); err == nil {
			config.TLSConfig.Insecure = insecure
		}
	}
	return config
}
func DefaultConfig ( ) * Config { config := & Config { Address : " " , HTTPClient : cleanhttp . DefaultClient ( ) , TLSConfig : & TLSConfig { } , } transport := config . HTTPClient . Transport . ( * http . Transport ) transport . TLSHandshakeTimeout = 10 * time . Second transport . TLSClientConfig = & tls . Config { MinVersion : tls . VersionTLS12 , } if addr := os . Getenv ( " " ) ; addr != " " { config . Address = addr } if auth := os . Getenv ( " " ) ; auth != " " { var username , password string if strings . Contains ( auth , " " ) { split := strings . SplitN ( auth , " " , 2 ) username = split [ 0 ] password = split [ 1 ] } else { username = auth } config . HTTPAuth = & HTTPBasicAuth { Username : username , Password : password , } } if v := os . Getenv ( " " ) ; v != " " { config . TLSConfig . CACert = v } if v := os . Getenv ( " " ) ; v != " " { config . TLSConfig . CAPath = v } if v := os . Getenv ( " " ) ; v != " " { config . TLSConfig . ClientCert = v } if v := os . Getenv ( " " ) ; v != " " { config . TLSConfig . ClientKey = v } if v := os . Getenv ( " " ) ; v != " " { if insecure , err := strconv . ParseBool ( v ) ; err == nil { config . TLSConfig . Insecure = insecure } } return config }
DefaultConfig returns a default configuration for the client
DefaultConfig returns a default configuration for the client
// Read TLS specific env vars