Method: Virtuaservices::Utils::Seeder#create_service
- Defined in:
- lib/virtuaservices/utils/seeder.rb
#create_service(key) ⇒ Virtuaservices::Monitoring::Service
Creates the service if it does not exist, and the instance if it does not exist.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/virtuaservices/utils/seeder.rb', line 10 def create_service(key) service = Virtuaservices::Monitoring::Service.where(key: key).first if service.nil? service = Virtuaservices::Monitoring::Service.create!(key: key, path: "/#{key}", premium: true, active: true) end if service.instances.where(url: ENV['SERVICE_URL']).first.nil? Virtuaservices::Monitoring::Instance.create!(url: ENV['SERVICE_URL'], running: true, service: service, active: true) end return service end |