Module: Virtuatable::Builders::Helpers::Registration

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/virtuatable/builders/helpers/registration.rb

Overview

Registers the service in the database by declaring it as a Arkaan::Monitoring::Service object, and declaring the instance.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#instanceObject (readonly)

Returns the value of attribute instance.



17
18
19
# File 'lib/virtuatable/builders/helpers/registration.rb', line 17

def instance
  @instance
end

#serviceObject (readonly)

Returns the value of attribute service.



14
15
16
# File 'lib/virtuatable/builders/helpers/registration.rb', line 14

def service
  @service
end

Instance Method Details

#load_registration!Object

Registers the service in the micro-services registry (consisting in the arkaan_monitoring_services and arkaan_monitoring_instances collections)



25
26
27
28
29
30
31
32
33
34
# File 'lib/virtuatable/builders/helpers/registration.rb', line 25

def load_registration!
  @service = Arkaan::Monitoring::Service.find_or_create_by!(
    key: @name,
    path: "/#{@name}"
  )
  @instance = service.instances.first_or_create!(
    type: type,
    url: ENV['SERVICE_URL']
  )
end