Module: Servicy::ExtraMethods

Defined in:
lib/api.rb

Instance Method Summary collapse

Instance Method Details

#search_queryObject

This method is used by the client discovery to build the query that can be used to find remote instances of this service



131
132
133
134
135
136
137
138
139
# File 'lib/api.rb', line 131

def search_query
  domain         = self.const_get(:DOMAIN) rescue `hostname`.strip
  name           = "#{domain}.#{self.to_s.downcase}"
  version        = self.const_get(:VERSION) rescue '1.0.0'
  port           = self.const_get(:PORT) rescue 1234
  heartbeat_port = self.const_get(:HEARTBEAT_PORT) rescue port

  { name: name, host: 'localhost', port: port, version: version, heartbeat_port: heartbeat_port }
end