class Xconsul::Consul::Service

Public Class Methods

hosts_with_port(service_name) click to toggle source

返回示例: ['10.10.142.233:8890', '192.168.0.2:8901']

# File lib/xconsul/consul/service.rb, line 6
def self.hosts_with_port(service_name)
  services = Diplomat::Service.get(service_name, :all)
  services.map { |service| "#{service.Address}:#{service.ServicePort}" }
end