Fix error parsing config when setting consul.timeout. (#6907)

When parsing a config file which had the consul.timeout param set,
Nomad was reporting an error causing startup to fail. This seems
to be caused by the HCL decoder interpreting the timeout type as
an int rather than a string. This is caused by the struct
TimeoutHCL param having a hcl key of timeout alongside a Timeout
struct param of type time.Duration (int). Ensuring the decoder
ignores the Timeout struct param ensure the decoder runs
correctly.
This commit is contained in:
James Rasell
2020-01-07 19:40:55 +01:00
committed by Tim Gross
parent 8e4a5f161d
commit bbf0bdbb2a

View File

@@ -65,8 +65,8 @@ type ConsulConfig struct {
GRPCAddr string `hcl:"grpc_address"`
// Timeout is used by Consul HTTP Client
Timeout time.Duration
TimeoutHCL string `hcl:"timeout" json:"-"`
Timeout time.Duration `hcl:"-"`
TimeoutHCL string `hcl:"timeout" json:"-"`
// Token is used to provide a per-request ACL token. This options overrides
// the agent's default token