-
Notifications
You must be signed in to change notification settings - Fork 783
/
config.go
49 lines (46 loc) · 2.13 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package docs
import (
"github.com/benthosdev/benthos/v4/internal/http/docs/auth"
"github.com/benthosdev/benthos/v4/internal/metadata"
"github.com/benthosdev/benthos/v4/internal/tls"
)
// Config is a configuration struct for an HTTP client.
type Config struct {
URL string `json:"url" yaml:"url"`
Verb string `json:"verb" yaml:"verb"`
Headers map[string]string `json:"headers" yaml:"headers"`
Metadata metadata.IncludeFilterConfig `json:"metadata" yaml:"metadata"`
ExtractMetadata metadata.IncludeFilterConfig `json:"extract_headers" yaml:"extract_headers"`
RateLimit string `json:"rate_limit" yaml:"rate_limit"`
Timeout string `json:"timeout" yaml:"timeout"`
Retry string `json:"retry_period" yaml:"retry_period"`
MaxBackoff string `json:"max_retry_backoff" yaml:"max_retry_backoff"`
NumRetries int `json:"retries" yaml:"retries"`
BackoffOn []int `json:"backoff_on" yaml:"backoff_on"`
DropOn []int `json:"drop_on" yaml:"drop_on"`
SuccessfulOn []int `json:"successful_on" yaml:"successful_on"`
TLS tls.Config `json:"tls" yaml:"tls"`
ProxyURL string `json:"proxy_url" yaml:"proxy_url"`
auth.Config `json:",inline" yaml:",inline"`
OAuth2 auth.OAuth2Config `json:"oauth2" yaml:"oauth2"`
}
// NewConfig creates a new Config with default values.
func NewConfig() Config {
return Config{
URL: "",
Verb: "POST",
Headers: map[string]string{},
ExtractMetadata: metadata.NewIncludeFilterConfig(),
RateLimit: "",
Timeout: "5s",
Retry: "1s",
MaxBackoff: "300s",
NumRetries: 3,
BackoffOn: []int{429},
DropOn: []int{},
SuccessfulOn: []int{},
TLS: tls.NewConfig(),
Config: auth.NewConfig(),
OAuth2: auth.NewOAuth2Config(),
}
}