MCPcopy Create free account
hub / github.com/prometheus/common / LoadHTTPConfigFile

Function LoadHTTPConfigFile

config/http_config.go:319–330  ·  view source on GitHub ↗

LoadHTTPConfigFile parses the given YAML file into a HTTPClientConfig.

(filename string)

Source from the content-addressed store, hash-verified

317
318// LoadHTTPConfigFile parses the given YAML file into a HTTPClientConfig.
319func LoadHTTPConfigFile(filename string) (*HTTPClientConfig, []byte, error) {
320 content, err := os.ReadFile(filename)
321 if err != nil {
322 return nil, nil, err
323 }
324 cfg, err := LoadHTTPConfig(string(content))
325 if err != nil {
326 return nil, nil, err
327 }
328 cfg.SetDirectory(filepath.Dir(filename))
329 return cfg, content, nil
330}
331
332// HTTPClientConfig configures an HTTP client.
333type HTTPClientConfig struct {

Callers 14

TestBasicAuthNoPasswordFunction · 0.85
TestBasicAuthNoUsernameFunction · 0.85
TestBasicUsernameFileFunction · 0.85
TestValidateHTTPConfigFunction · 0.85
TestInvalidHTTPConfigsFunction · 0.85
TestOAuth2ProxyFunction · 0.85
TestHeadersFunction · 0.85

Calls 2

LoadHTTPConfigFunction · 0.85
SetDirectoryMethod · 0.65

Tested by 14

TestBasicAuthNoPasswordFunction · 0.68
TestBasicAuthNoUsernameFunction · 0.68
TestBasicUsernameFileFunction · 0.68
TestValidateHTTPConfigFunction · 0.68
TestInvalidHTTPConfigsFunction · 0.68
TestOAuth2ProxyFunction · 0.68
TestHeadersFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…