Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/backends/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type EtcdConfig struct {
// The default is 2.
Version int
template.Backend

// The timeout per request
RequestTimeout int `toml:"request_timeout"`
}

// Connect creates a new etcd{2,3}Client and fills the underlying template.Backend with the etcd-Backend specific data.
Expand All @@ -68,6 +71,11 @@ func (c *EtcdConfig) Connect() (template.Backend, error) {
c.Backend.Name = "etcd"
}

// Use default request timeout of 3
if c.RequestTimeout == 0 {
c.RequestTimeout = 3
}

// No nodes are set but a SRVRecord is provided
if len(c.Nodes) == 0 && c.SRVRecord != "" {
var err error
Expand Down Expand Up @@ -101,7 +109,8 @@ func (c *EtcdConfig) Connect() (template.Backend, error) {
ClientKey: c.ClientKey,
ClientCaKeys: c.ClientCaKeys,
}),
etcd.WithVersion(c.Version))
etcd.WithVersion(c.Version),
etcd.WithRequestTimeout(c.RequestTimeout))

if err != nil {
return c.Backend, err
Expand Down