Set timeout for marathon_sd

pull/2045/head
bekbulatov 9 years ago
parent c689b35858
commit 2bc12fa2fb
  1. 2
      config/config.go
  2. 1
      config/config_test.go
  3. 1
      retrieval/discovery/marathon/marathon.go

@ -124,6 +124,7 @@ var (
// DefaultMarathonSDConfig is the default Marathon SD configuration.
DefaultMarathonSDConfig = MarathonSDConfig{
Timeout: model.Duration(30 * time.Second),
RefreshInterval: model.Duration(30 * time.Second),
}
@ -776,6 +777,7 @@ func (c *NerveSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
// MarathonSDConfig is the configuration for services running on Marathon.
type MarathonSDConfig struct {
Servers []string `yaml:"servers,omitempty"`
Timeout model.Duration `yaml:"timeout,omitempty"`
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`

@ -269,6 +269,7 @@ var expectedConf = &Config{
Servers: []string{
"https://marathon.example.com:443",
},
Timeout: model.Duration(30 * time.Second),
RefreshInterval: model.Duration(30 * time.Second),
TLSConfig: TLSConfig{
CertFile: "testdata/valid_cert_file",

@ -87,6 +87,7 @@ func NewDiscovery(conf *config.MarathonSDConfig) (*Discovery, error) {
}
client := &http.Client{
Timeout: time.Duration(conf.Timeout),
Transport: &http.Transport{
TLSClientConfig: tls,
},

Loading…
Cancel
Save