lib/capistrano/consul.rb in capistrano3-consul-0.3.3 vs lib/capistrano/consul.rb in capistrano3-consul-0.3.4
- old
+ new
@@ -25,17 +25,19 @@
end
module DSL
def consul_all_nodes(properties = {})
Consul.setup
- Diplomat::Node.get_all.each do |node|
+ Diplomat::Node.get_all.each_with_index do |node, index|
+ properties[:primary] = true if index == 0
server(node['Address'], properties)
end
end
def consul_service(service_name, properties = {})
Consul.setup
- Diplomat::Service.get(service_name, :all).each do |node|
+ Diplomat::Service.get(service_name, :all).each_with_index do |node, index|
+ properties[:primary] = true if index == 0
server(node['Address'], properties)
end
end
end
end