Set timeout for marathon_sd

This commit is contained in:
bekbulatov 2016-10-24 11:27:08 +01:00
parent c689b35858
commit 2bc12fa2fb
3 changed files with 4 additions and 0 deletions

View file

@ -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"`

View file

@ -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",

View 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,
},