Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TLSSkipVerify for https also. Reduce repetition of Timeout #692

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
21 changes: 6 additions & 15 deletions consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,11 @@ func (r *ConsulAdapter) buildCheck(service *bridge.Service) *consulapi.AgentServ
}
if path := service.Attrs["check_http"]; path != "" {
check.HTTP = fmt.Sprintf("http://%s:%d%s", service.IP, service.Port, path)
if timeout := service.Attrs["check_timeout"]; timeout != "" {
check.Timeout = timeout
}
if method := service.Attrs["check_http_method"]; method != "" {
check.Method = method
}
} else if path := service.Attrs["check_https"]; path != "" {
check.HTTP = fmt.Sprintf("https://%s:%d%s", service.IP, service.Port, path)
if timeout := service.Attrs["check_timeout"]; timeout != "" {
check.Timeout = timeout
}
if method := service.Attrs["check_https_method"]; method != "" {
check.Method = method
}
Expand All @@ -118,19 +112,10 @@ func (r *ConsulAdapter) buildCheck(service *bridge.Service) *consulapi.AgentServ
check.TTL = ttl
} else if tcp := service.Attrs["check_tcp"]; tcp != "" {
check.TCP = fmt.Sprintf("%s:%d", service.IP, service.Port)
if timeout := service.Attrs["check_timeout"]; timeout != "" {
check.Timeout = timeout
}
} else if grpc := service.Attrs["check_grpc"]; grpc != "" {
check.GRPC = fmt.Sprintf("%s:%d", service.IP, service.Port)
if timeout := service.Attrs["check_timeout"]; timeout != "" {
check.Timeout = timeout
}
if useTLS := service.Attrs["check_grpc_use_tls"]; useTLS != "" {
check.GRPCUseTLS = true
if tlsSkipVerify := service.Attrs["check_tls_skip_verify"]; tlsSkipVerify != "" {
check.TLSSkipVerify = true
}
}
} else {
return nil
Expand All @@ -141,6 +126,12 @@ func (r *ConsulAdapter) buildCheck(service *bridge.Service) *consulapi.AgentServ
} else {
check.Interval = DefaultInterval
}
if timeout := service.Attrs["check_timeout"]; timeout != "" {
check.Timeout = timeout
}
if tlsSkipVerify := service.Attrs["check_tls_skip_verify"]; tlsSkipVerify != "" {
check.TLSSkipVerify = true
}
}
if deregister_after := service.Attrs["check_deregister_after"]; deregister_after != "" {
check.DeregisterCriticalServiceAfter = deregister_after
Expand Down