diff --git a/command/agent/agent_endpoint.go b/command/agent/agent_endpoint.go index 6d31d786e..f4b9c06d7 100644 --- a/command/agent/agent_endpoint.go +++ b/command/agent/agent_endpoint.go @@ -118,10 +118,17 @@ func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Re if !ok { return nil } - check, ok := rawMap["check"] - if !ok { + + var check interface{} + for k, v := range rawMap { + if strings.ToLower(k) == "check" { + check = v + } + } + if check == nil { return nil } + return FixupCheckType(check) } if err := decodeBody(req, &args, decodeCB); err != nil { diff --git a/command/agent/config.go b/command/agent/config.go index 22789cbdc..7dfd2a945 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -265,23 +265,38 @@ func FixupCheckType(raw interface{}) error { if !ok { return nil } - if ttl, ok := rawMap["ttl"]; ok { + + var ttlKey string + for k, _ := range rawMap { + if strings.ToLower(k) == "ttl" { + ttlKey = k + } + } + var intervalKey string + for k, _ := range rawMap { + if strings.ToLower(k) == "interval" { + intervalKey = k + } + } + + if ttl, ok := rawMap[ttlKey]; ok { ttlS, ok := ttl.(string) if ok { if dur, err := time.ParseDuration(ttlS); err != nil { return err } else { - rawMap["ttl"] = dur + rawMap[ttlKey] = dur } } } - if interval, ok := rawMap["interval"]; ok { + + if interval, ok := rawMap[intervalKey]; ok { intervalS, ok := interval.(string) if ok { if dur, err := time.ParseDuration(intervalS); err != nil { return err } else { - rawMap["interval"] = dur + rawMap[intervalKey] = dur } } }