Class: EurekaRuby::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/eureka_ruby/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
# File 'lib/eureka_ruby/configuration.rb', line 12

def initialize
  @health_path     = 'health'
  @health_response = 'OK'
  @health_headers  = { "Content-Type" => "text/plain" }
  @info_path       = 'info'
  @port            = 3000
  @scheme          = 'http'
end

Instance Method Details

#application_pathObject



29
30
31
# File 'lib/eureka_ruby/configuration.rb', line 29

def application_path
  'apps/' + app_id
end

#instance_idObject



21
22
23
# File 'lib/eureka_ruby/configuration.rb', line 21

def instance_id
  "#{host_name}:#{ip_addr}:#{port}"
end

#instance_pathObject



25
26
27
# File 'lib/eureka_ruby/configuration.rb', line 25

def instance_path
  'apps/' + app_id + '/' + instance_id
end

#register_payloadObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/eureka_ruby/configuration.rb', line 33

def register_payload
  {
    instance: {
      instanceId: instance_id,
      hostName: host_name,
      app: app_id,
      ipAddr: ip_addr,
      status: "UP",
      vipAddress: app_id,
      secureVipAddress: app_id,
      port: { "$": port, "@enabled": "true" },
      securePort: { "$": "8443", "@enabled": "false" },
      healthCheckUrl: "#{scheme}://#{ip_addr}:#{port}#{health_path}",
      statusPageUrl: "#{scheme}://#{ip_addr}:#{port}#{info_path}",
      homePageUrl: "#{scheme}://#{ip_addr}:#{port}/",
      dataCenterInfo: {
        "@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
        name: "MyOwn"
      }
    }
  }
end